File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 6262#include < processthreadsapi.h>
6363#endif
6464
65+ #if SWIFT_OBJC_INTEROP
66+ extern " C" void *objc_autoreleasePoolPush ();
67+ extern " C" void objc_autoreleasePoolPop (void *);
68+ #endif
69+
6570using namespace swift ;
6671
6772// / Should we yield the thread?
@@ -198,6 +203,10 @@ SWIFT_RUNTIME_DECLARE_THREAD_LOCAL(
198203void swift::runJobInEstablishedExecutorContext (Job *job) {
199204 _swift_tsan_acquire (job);
200205
206+ #if SWIFT_OBJC_INTEROP
207+ auto pool = objc_autoreleasePoolPush ();
208+ #endif
209+
201210 if (auto task = dyn_cast<AsyncTask>(job)) {
202211 // Update the active task in the current thread.
203212 ActiveTask::set (task);
@@ -216,6 +225,10 @@ void swift::runJobInEstablishedExecutorContext(Job *job) {
216225 job->runSimpleInFullyEstablishedContext ();
217226 }
218227
228+ #if SWIFT_OBJC_INTEROP
229+ objc_autoreleasePoolPop (pool);
230+ #endif
231+
219232 _swift_tsan_release (job);
220233}
221234
You can’t perform that action at this time.
0 commit comments