Skip to content

Commit 13cc56b

Browse files
committed
Build on Windows
Windows doesn't have dlsym. Since I don't have a Windows box, I'm just if-def'ing it out for the time being. Since we don't want Windows going off and doing dangerous things, I threw in an abort just to be safe.
1 parent 81ae9d6 commit 13cc56b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
#include <dispatch/dispatch.h>
2626

27+
#if !defined(_WIN32)
2728
#include <dlfcn.h>
29+
#endif
2830

2931
using namespace swift;
3032
using FutureFragment = AsyncTask::FutureFragment;
@@ -534,10 +536,17 @@ void swift::swift_continuation_logFailedCheck(const char *message) {
534536
}
535537

536538
void swift::swift_task_asyncMainDrainQueue() {
539+
#if !defined(_WIN32)
537540
auto runLoop =
538541
reinterpret_cast<void (*)(void)>(dlsym(RTLD_DEFAULT, "CFRunLoopRun"));
539542
if (runLoop)
540543
runLoop();
541544
else
542545
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+
#endif
543552
}

test/Concurrency/async_main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// REQUIRES: concurrency
66
// REQUIRES: executable_test
7+
// REQUIRES: OS=macosx || OS=ios
78

89
func asyncFunc() async {
910
print("Hello World!")

test/Concurrency/async_main_throws_prints_error.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
// REQUIRES: concurrency
88
// REQUIRES: executable_test
9+
// REQUIRES: OS=macosx || OS=ios
910

1011
enum Err : Error { case noGood }
1112

0 commit comments

Comments
 (0)