File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -536,17 +536,29 @@ void swift::swift_continuation_logFailedCheck(const char *message) {
536
536
}
537
537
538
538
void swift::swift_task_asyncMainDrainQueue () {
539
- #if !defined(_WIN32)
539
+ #if defined(_WIN32)
540
+ static void (FAR *pfndispatch_main)(void ) = NULL ;
541
+
542
+ if (pfndispatch_main)
543
+ return pfndispatch_main ();
544
+
545
+ HMODULE hModule = LoadLibraryW (L" dispatch.dll" );
546
+ if (hModule == NULL )
547
+ abort ();
548
+
549
+ pfndispatch_main =
550
+ reinterpret_cast <void (FAR *)(void )>(GetProcAddress (hModule,
551
+ " dispatch_main" ));
552
+ if (pfndispatch_main == NULL )
553
+ abort ();
554
+
555
+ pfndispatch_main ();
556
+ #else
540
557
auto runLoop =
541
558
reinterpret_cast <void (*)(void )>(dlsym (RTLD_DEFAULT, " CFRunLoopRun" ));
542
559
if (runLoop)
543
560
runLoop ();
544
561
else
545
562
dispatch_main ();
546
- #else
547
- // TODO: I don't have a windows box to get this working right now.
548
- // We need to either pull in the CFRunLoop if it's available, or do
549
- // something that will drain the main queue. Exploding for now.
550
- abort ();
551
563
#endif
552
564
}
You can’t perform that action at this time.
0 commit comments