Skip to content

Commit 67728ea

Browse files
authored
Merge pull request #61933 from compnerd/dispatch
Concurrency: support newer dispatch functionality on Windows
2 parents 8621537 + a066a6e commit 67728ea

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

stdlib/public/Concurrency/DispatchGlobalExecutor.inc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,18 @@ static void initializeDispatchEnqueueFunc(dispatch_queue_t queue, void *obj,
8484
dispatch_qos_class_t qos) {
8585
dispatchEnqueueFuncType func = nullptr;
8686

87-
// Always fall back to plain dispatch_async_f on Windows for now, and
88-
// also for back-deployed concurrency.
89-
#if !defined(_WIN32) && !defined(SWIFT_CONCURRENCY_BACK_DEPLOYMENT)
87+
// Always fall back to plain dispatch_async_f for back-deployed concurrency.
88+
#if !defined(SWIFT_CONCURRENCY_BACK_DEPLOYMENT)
9089
if (runtime::environment::concurrencyEnableJobDispatchIntegration())
90+
#if defined(_WIN32)
91+
func = reinterpret_cast<dispatchEnqueueFuncType>(
92+
GetProcAddress(LoadLibraryW(L"dispatch.dll"),
93+
"dispatch_async_swift_job"));
94+
#else
9195
func = reinterpret_cast<dispatchEnqueueFuncType>(
9296
dlsym(RTLD_NEXT, "dispatch_async_swift_job"));
97+
98+
#endif
9399
#endif
94100

95101
if (!func)

0 commit comments

Comments
 (0)