File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -78,9 +78,39 @@ func groups() async {
78
78
}
79
79
}
80
80
81
+ @available ( SwiftStdlib 5 . 5 , * )
82
+ func taskInsideGroup( ) async {
83
+ Task {
84
+ print ( " outside " ) // CHECK: outside
85
+ _ = await withTaskGroup ( of: Int . self) { group -> Int in
86
+ print ( " in group " ) // CHECK: in group
87
+ printTaskLocal ( TL . $number) // CHECK: TaskLocal<Int>(defaultValue: 0) (0)
88
+
89
+ for _ in 0 ..< 5 {
90
+ Task {
91
+ printTaskLocal ( TL . $number)
92
+ print ( " some task " )
93
+ }
94
+ }
95
+
96
+ return 0
97
+ }
98
+ }
99
+
100
+ // CHECK: some task
101
+ // CHECK: some task
102
+ // CHECK: some task
103
+ // CHECK: some task
104
+
105
+ await Task . sleep ( 5 * 1_000_000_000 )
106
+
107
+ // await t.value
108
+ }
109
+
81
110
@available ( SwiftStdlib 5 . 5 , * )
82
111
@main struct Main {
83
112
static func main( ) async {
84
113
await groups ( )
114
+ await taskInsideGroup ( )
85
115
}
86
116
}
You can’t perform that action at this time.
0 commit comments