Skip to content

Commit 921112a

Browse files
committed
Use withUnsafePointer(to:) rather than withUnsafeBytes(of:)
1 parent 64a97fc commit 921112a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

stdlib/public/Concurrency/TaskGroup.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ public struct TaskGroup<ChildTaskResult> {
246246
flags.addPendingGroupTaskUnconditionally = true
247247

248248
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
249-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
249+
withUnsafePointer(to: &groupOption) { optionsPtr in
250250
// Create the asynchronous task future.
251251
_ = Builtin.createAsyncTask(
252-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
252+
flags.bits, optionsPtr._rawValue, operation)
253253
}
254254
}
255255

@@ -285,10 +285,10 @@ public struct TaskGroup<ChildTaskResult> {
285285
flags.enqueueJob = true
286286

287287
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
288-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
288+
withUnsafePointer(to: &groupOption) { optionsPtr in
289289
// Create the asynchronous task future.
290290
_ = Builtin.createAsyncTask(
291-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
291+
flags.bits, optionsPtr._rawValue, operation)
292292
}
293293

294294
return true
@@ -467,10 +467,10 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
467467
flags.addPendingGroupTaskUnconditionally = true
468468

469469
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
470-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
470+
withUnsafePointer(to: &groupOption) { optionsPtr in
471471
// Create the asynchronous task future.
472472
_ = Builtin.createAsyncTask(
473-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
473+
flags.bits, optionsPtr._rawValue, operation)
474474
}
475475
}
476476

@@ -506,10 +506,10 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
506506
flags.enqueueJob = true
507507

508508
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
509-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
509+
withUnsafePointer(to: &groupOption) { optionsPtr in
510510
// Create the asynchronous task future.
511511
_ = Builtin.createAsyncTask(
512-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
512+
flags.bits, optionsPtr._rawValue, operation)
513513
}
514514

515515
return true

0 commit comments

Comments
 (0)