Skip to content

Commit 29b45a3

Browse files
committed
Use withUnsafePointer(to:) rather than withUnsafeBytes(of:)
1 parent a4af1a7 commit 29b45a3

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
@@ -218,10 +218,10 @@ public struct TaskGroup<ChildTaskResult> {
218218
flags.addPendingGroupTaskUnconditionally = true
219219

220220
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
221-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
221+
withUnsafePointer(to: &groupOption) { optionsPtr in
222222
// Create the asynchronous task future.
223223
_ = Builtin.createAsyncTask(
224-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
224+
flags.bits, optionsPtr._rawValue, operation)
225225
}
226226
}
227227

@@ -257,10 +257,10 @@ public struct TaskGroup<ChildTaskResult> {
257257
flags.enqueueJob = true
258258

259259
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
260-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
260+
withUnsafePointer(to: &groupOption) { optionsPtr in
261261
// Create the asynchronous task future.
262262
_ = Builtin.createAsyncTask(
263-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
263+
flags.bits, optionsPtr._rawValue, operation)
264264
}
265265

266266
return true
@@ -447,10 +447,10 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
447447
flags.addPendingGroupTaskUnconditionally = true
448448

449449
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
450-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
450+
withUnsafePointer(to: &groupOption) { optionsPtr in
451451
// Create the asynchronous task future.
452452
_ = Builtin.createAsyncTask(
453-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
453+
flags.bits, optionsPtr._rawValue, operation)
454454
}
455455
}
456456

@@ -486,10 +486,10 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
486486
flags.enqueueJob = true
487487

488488
var groupOption = TaskOptionRecord.TaskGroup(group: _group)
489-
withUnsafeBytes(of: &groupOption) { optionsBuffer in
489+
withUnsafePointer(to: &groupOption) { optionsPtr in
490490
// Create the asynchronous task future.
491491
_ = Builtin.createAsyncTask(
492-
flags.bits, optionsBuffer.baseAddress?._rawValue, operation)
492+
flags.bits, optionsPtr._rawValue, operation)
493493
}
494494

495495
return true

0 commit comments

Comments
 (0)