Skip to content

Instantly share code, notes, and snippets.

@networkextension
Created November 8, 2016 13:27
Show Gist options
  • Select an option

  • Save networkextension/b15d32eeb984e8f87736d496477818a6 to your computer and use it in GitHub Desktop.

Select an option

Save networkextension/b15d32eeb984e8f87736d496477818a6 to your computer and use it in GitHub Desktop.
dispatch_after Swift3
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