We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 63d5cf1 + c3f8858 commit 86c9e87Copy full SHA for 86c9e87
test/Concurrency/Runtime/async_task_detached.swift
@@ -0,0 +1,33 @@
1
+// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s
2
+
3
+// REQUIRES: executable_test
4
+// REQUIRES: concurrency
5
6
+class X {
7
+ init() {
8
+ print("X: init")
9
+ }
10
+ deinit {
11
+ print("X: deinit")
12
13
+}
14
15
+func test_detach() async {
16
+ for _ in 1...3 {
17
+ let x = X()
18
+ let h = Task.runDetached {
19
+ print("inside: \(x)")
20
21
+ await h.get()
22
23
+ // CHECK: X: init
24
+ // CHECK: inside: main.X
25
+ // CHECK: X: deinit
26
27
28
29
+@main struct Main {
30
+ static func main() async {
31
+ await test_detach()
32
33
0 commit comments