Skip to content

Commit 477f37f

Browse files
authored
Merge pull request #73564 from ktoso/wip-extra-test
2 parents 278e778 + 4acaa40 commit 477f37f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library %s -o %t/a.out
3+
// RUN: %target-codesign %t/a.out
4+
// RUN: %target-run %t/a.out
5+
6+
// REQUIRES: executable_test
7+
// REQUIRES: concurrency
8+
// REQUIRES: concurrency_runtime
9+
10+
// REQUIRES: libdispatch
11+
12+
// UNSUPPORTED: back_deployment_runtime
13+
// UNSUPPORTED: back_deploy_concurrency
14+
// UNSUPPORTED: use_os_stdlib
15+
// UNSUPPORTED: freestanding
16+
17+
import Dispatch
18+
19+
#if os(macOS)
20+
import Darwin
21+
#elseif canImport(Glibc)
22+
import Glibc
23+
#elseif canImport(Musl)
24+
import Musl
25+
#endif
26+
27+
@main struct Main {
28+
static func main() {
29+
if #available(SwiftStdlib 6.0, *) {
30+
31+
Swift.print("start detached")
32+
Task.detached {
33+
Swift.print("DispatchQueue.main.async { MainActor.precondition }")
34+
35+
DispatchQueue.main.async {
36+
MainActor.preconditionIsolated("I know I'm on the main queue")
37+
38+
Swift.print("OK")
39+
exit(0)
40+
}
41+
}
42+
43+
dispatchMain()
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)