Created
September 16, 2016 21:25
-
-
Save sebcode/39ea52e994ec6f114d47c99f118c0afa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
let queue = Cocoa.OperationQueue() | |
let sema = DispatchSemaphore.init(value: 0) | |
queue.addOperation { | |
print("T1 Wait") | |
queue.addOperation { | |
sleep(5) | |
print("T2 Signal") | |
sema.signal() | |
} | |
_ = sema.wait(timeout: .distantFuture) | |
print("T1 DONE") | |
exit(0) | |
} | |
print("Runloop") | |
CFRunLoopRun() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment