@@ -218,9 +218,11 @@ public struct TaskGroup<ChildTaskResult> {
218
218
flags. addPendingGroupTaskUnconditionally = true
219
219
220
220
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
221
-
222
- // Create the asynchronous task future.
223
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
221
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
222
+ // Create the asynchronous task future.
223
+ _ = Builtin . createAsyncTask (
224
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
225
+ }
224
226
}
225
227
226
228
/// Add a child task to the group.
@@ -255,9 +257,11 @@ public struct TaskGroup<ChildTaskResult> {
255
257
flags. enqueueJob = true
256
258
257
259
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
258
-
259
- // Create the asynchronous task future.
260
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
260
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
261
+ // Create the asynchronous task future.
262
+ _ = Builtin . createAsyncTask (
263
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
264
+ }
261
265
262
266
return true
263
267
}
@@ -443,9 +447,11 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
443
447
flags. addPendingGroupTaskUnconditionally = true
444
448
445
449
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
446
-
447
- // Create the asynchronous task future.
448
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
450
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
451
+ // Create the asynchronous task future.
452
+ _ = Builtin . createAsyncTask (
453
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
454
+ }
449
455
}
450
456
451
457
/// Add a child task to the group.
@@ -480,9 +486,11 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
480
486
flags. enqueueJob = true
481
487
482
488
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
483
-
484
- // Create the asynchronous task future.
485
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
489
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
490
+ // Create the asynchronous task future.
491
+ _ = Builtin . createAsyncTask (
492
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
493
+ }
486
494
487
495
return true
488
496
}
0 commit comments