Skip to content

Commit 14ab1a2

Browse files
committed
Cleanup after rebase
1 parent 28ce3d9 commit 14ab1a2

20 files changed

+9
-128
lines changed

test/Concurrency/Runtime/actor_counters.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
// REQUIRES: concurrency
55
// REQUIRES: libdispatch
66

7-
#if canImport(Darwin)
8-
import Darwin
9-
#elseif canImport(Glibc)
10-
import Glibc
11-
#endif
12-
137
actor Counter {
148
private var value = 0
159
private let scratchBuffer: UnsafeMutableBufferPointer<Int>

test/Concurrency/Runtime/async_let_fibonacci.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
// REQUIRES: concurrency
55
// REQUIRES: libdispatch
66

7-
#if canImport(Darwin)
8-
import Darwin
9-
#elseif canImport(Glibc)
10-
import Glibc
11-
#endif
12-
137
func fib(_ n: Int) -> Int {
148
var first = 0
159
var second = 1

test/Concurrency/Runtime/async_task_cancellation_early.swift

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

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func test_runDetached_cancel_child_early() async {
1610
print(#function) // CHECK: test_runDetached_cancel_child_early
1711
let h: Task.Handle<Bool, Error> = Task.runDetached {
1812
async let childCancelled: Bool = { () -> Bool in
19-
sleep(2)
13+
await Task.sleep(2_000_000_000)
2014
return Task.isCancelled
2115
}()
2216

test/Concurrency/Runtime/async_task_cancellation_while_running.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@
66

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func test_runDetached_cancel_while_child_running() async {
1610
let h: Task.Handle<Bool, Error> = Task.runDetached {
1711
async let childCancelled: Bool = { () -> Bool in
18-
sleep(3)
12+
await Task.sleep(3_000_000_000)
1913
return Task.isCancelled
2014
}()
2115

@@ -27,7 +21,7 @@ func test_runDetached_cancel_while_child_running() async {
2721
}
2822

2923
// sleep here, i.e. give the task a moment to start running
30-
sleep(2)
24+
await Task.sleep(2_000_000_000)
3125

3226
h.cancel()
3327
print("handle cancel")

test/Concurrency/Runtime/async_task_equals_hashCode.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
// REQUIRES: concurrency
55
// UNSUPPORTED: OS=windows-msvc
66

7-
#if canImport(Darwin)
8-
import Darwin
9-
#elseif canImport(Glibc)
10-
import Glibc
11-
#endif
12-
137
func simple() async {
148
print("\(#function) -----------------------")
159
let one = await Task.current()

test/Concurrency/Runtime/async_task_priority_current.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func test_detach() async {
1610
let a1 = Task.currentPriority
1711
print("a1: \(a1)") // CHECK: a1: default

test/Concurrency/Runtime/async_taskgroup_cancelAll_only_specific_group.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func asyncEcho(_ value: Int) async -> Int {
1610
value
1711
}
@@ -23,7 +17,7 @@ func test_taskGroup_cancelAll_onlySpecificGroup() async {
2317

2418
for i in 1...5 {
2519
await group.add {
26-
sleep(1)
20+
await Task.sleep(1_000_000_000)
2721
let c = Task.isCancelled
2822
print("add: \(i) (cancelled: \(c))")
2923
return i
@@ -48,7 +42,7 @@ func test_taskGroup_cancelAll_onlySpecificGroup() async {
4842
let g2: Int = try! await Task.withGroup(resultType: Int.self) { group in
4943
for i in 1...3 {
5044
await group.add {
51-
sleep(1)
45+
await Task.sleep(1_000_000_000)
5246
let c = Task.isCancelled
5347
print("g1 task \(i) (cancelled: \(c))")
5448
return i

test/Concurrency/Runtime/async_taskgroup_cancel_from_inside_child.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func test_taskGroup_cancel_from_inside_child() async {
1610
let result: Int = try! await Task.withGroup(resultType: Int.self) { group in
1711
let firstAdded = await group.add { [group] in // must explicitly capture, as the task executes concurrently

test/Concurrency/Runtime/async_taskgroup_cancel_parent_affects_group.swift

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

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func asyncEcho(_ value: Int) async -> Int {
1610
value
1711
}
@@ -21,7 +15,7 @@ func test_taskGroup_cancel_parent_affects_group() async {
2115
let x = Task.runDetached {
2216
try! await Task.withGroup(resultType: Int.self) { group -> Void in
2317
await group.add {
24-
sleep(3)
18+
await Task.sleep(3_000_000_000)
2519
let c = Task.isCancelled
2620
print("group task isCancelled: \(c)")
2721
return 0

test/Concurrency/Runtime/async_taskgroup_cancel_then_add.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
import Dispatch
88

9-
#if canImport(Darwin)
10-
import Darwin
11-
#elseif canImport(Glibc)
12-
import Glibc
13-
#endif
14-
159
func asyncEcho(_ value: Int) async -> Int {
1610
value
1711
}

0 commit comments

Comments
 (0)