File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2201,7 +2201,11 @@ static void swift_task_deinitOnExecutorImpl(void *object,
2201
2201
// but we don't have a tail call anyway, so this does not help much here.
2202
2202
// Always create new tracking info to keep code simple.
2203
2203
ExecutorTrackingInfo trackingInfo;
2204
- trackingInfo.enterAndShadow (newExecutor, TaskExecutorRef::undefined ());
2204
+ TaskExecutorRef taskExecutor = TaskExecutorRef::undefined ();
2205
+ if (ExecutorTrackingInfo *current = ExecutorTrackingInfo::current ()) {
2206
+ taskExecutor = current->getTaskExecutor ();
2207
+ }
2208
+ trackingInfo.enterAndShadow (newExecutor, taskExecutor);
2205
2209
2206
2210
// Run the work.
2207
2211
work (object);
@@ -2210,6 +2214,7 @@ static void swift_task_deinitOnExecutorImpl(void *object,
2210
2214
// If it calls any synchronous API that may change executor inside
2211
2215
// tracking info, that API is also responsible for changing it back.
2212
2216
assert (newExecutor == trackingInfo.getActiveExecutor ());
2217
+ assert (taskExecutor == trackingInfo.getTaskExecutor ());
2213
2218
2214
2219
// Leave the tracking frame
2215
2220
trackingInfo.leave ();
You can’t perform that action at this time.
0 commit comments