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.
1 parent 8da48c7 commit 1b6f355Copy full SHA for 1b6f355
Tests/AllocatedLockTests.swift
@@ -56,20 +56,21 @@ final class AllocatedLockTests: XCTestCase {
56
XCTAssertTrue(value)
57
}
58
59
+
60
func testLock_Blocks() async {
61
let lock = AllocatedLock()
62
+ await MainActor.run {
63
+ lock.unsafeLock()
64
+ }
65
66
Task { @MainActor in
- lock.unsafeLock()
- try? await Task.sleep(nanoseconds: 1_000_000_000)
67
+ try? await Task.sleep(nanoseconds: 200_000)
68
lock.unsafeUnlock()
69
70
- try? await Task.sleep(nanoseconds: 500_000)
-
71
let results = await withTaskGroup(of: Bool.self) { group in
72
group.addTask {
- try? await Task.sleep(nanoseconds: 5_000_000)
73
+ try? await Task.sleep(nanoseconds: 10_000)
74
return true
75
76
0 commit comments