@@ -246,9 +246,11 @@ public struct TaskGroup<ChildTaskResult> {
246
246
flags. addPendingGroupTaskUnconditionally = true
247
247
248
248
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
249
-
250
- // Create the asynchronous task future.
251
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
249
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
250
+ // Create the asynchronous task future.
251
+ _ = Builtin . createAsyncTask (
252
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
253
+ }
252
254
}
253
255
254
256
/// Add a child task to the group.
@@ -283,9 +285,11 @@ public struct TaskGroup<ChildTaskResult> {
283
285
flags. enqueueJob = true
284
286
285
287
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
286
-
287
- // Create the asynchronous task future.
288
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
288
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
289
+ // Create the asynchronous task future.
290
+ _ = Builtin . createAsyncTask (
291
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
292
+ }
289
293
290
294
return true
291
295
}
@@ -463,9 +467,11 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
463
467
flags. addPendingGroupTaskUnconditionally = true
464
468
465
469
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
466
-
467
- // Create the asynchronous task future.
468
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
470
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
471
+ // Create the asynchronous task future.
472
+ _ = Builtin . createAsyncTask (
473
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
474
+ }
469
475
}
470
476
471
477
/// Add a child task to the group.
@@ -500,9 +506,11 @@ public struct ThrowingTaskGroup<ChildTaskResult, Failure: Error> {
500
506
flags. enqueueJob = true
501
507
502
508
var groupOption = TaskOptionRecord . TaskGroup ( group: _group)
503
-
504
- // Create the asynchronous task future.
505
- _ = Builtin . createAsyncTask ( flags. bits, UnsafeRawPointer ( & groupOption) . _rawValue, operation)
509
+ withUnsafeBytes ( of: & groupOption) { optionsBuffer in
510
+ // Create the asynchronous task future.
511
+ _ = Builtin . createAsyncTask (
512
+ flags. bits, optionsBuffer. baseAddress? . _rawValue, operation)
513
+ }
506
514
507
515
return true
508
516
}
0 commit comments