Created
November 8, 2016 13:27
-
-
Save networkextension/b15d32eeb984e8f87736d496477818a6 to your computer and use it in GitHub Desktop.
dispatch_after Swift3
This file contains hidden or 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 UIKit | |
| var str = "Hello, playground" | |
| let x = UINT32_MAX | |
| print(Date()) | |
| let q = DispatchQueue.init(label: "test", qos: .background, attributes: .init(rawValue: 0), autoreleaseFrequency: .never, target: nil) | |
| var flag = true | |
| print(q.label) | |
| q.asyncAfter(deadline: .now() + 3) { | |
| if flag { | |
| print("\(Date()) 500 msec seconds later") | |
| }else { | |
| print("\(Date()) 500 cancel") | |
| } | |
| } | |
| for i in 0 ..< 100 { | |
| print(Date()) | |
| sleep(1) | |
| flag = false | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment