Skip to content

Commit 425f01e

Browse files
committed
better sema
1 parent 6c86981 commit 425f01e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ExecutionContext/Semaphore.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class Semaphore {
5151
public func wait(until:NSDate? = nil) -> Bool {
5252
underlyingSemaphore.lock()
5353
defer {
54-
value -= 1
5554
underlyingSemaphore.unlock()
5655
}
5756

@@ -63,6 +62,10 @@ public class Semaphore {
6362
}
6463
}
6564

65+
if signaled {
66+
value -= 1
67+
}
68+
6669
return signaled
6770
}
6871

0 commit comments

Comments
 (0)