File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1442,7 +1442,8 @@ static void swift_continuation_awaitImpl(ContinuationAsyncContext *context) {
1442
1442
//
1443
1443
// This condition variable can be allocated on the stack of the blocking
1444
1444
// thread - with the address of it published to the resuming thread via the
1445
- // context.
1445
+ // context. We do this in a new scope.
1446
+ do {
1446
1447
ConditionVariable Cond;
1447
1448
1448
1449
context->Cond = &Cond;
@@ -1495,7 +1496,10 @@ static void swift_continuation_awaitImpl(ContinuationAsyncContext *context) {
1495
1496
1496
1497
#if SWIFT_CONCURRENCY_TASK_TO_THREAD_MODEL
1497
1498
// Since the condition variable is stack allocated, we don't need to do
1498
- // anything here to clean up
1499
+ // anything here to clean up. But we do have to end the scope that we
1500
+ // created the condition variable in so that it'll be destroyed before
1501
+ // we try to tail-call.
1502
+ } while (false );
1499
1503
#else
1500
1504
// Restore the running state of the task and resume it.
1501
1505
task->flagAsRunning ();
You can’t perform that action at this time.
0 commit comments