Skip to content

Instantly share code, notes, and snippets.

@rnapier
Forked from beccadax/dispatch-sync-safe.swift
Created June 13, 2014 20:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
func dispatch_sync<R> (queue: dispatch_queue_t, block: Void -> R ) -> R {
var result: R!
dispatch_sync(queue) {
result = block()
}
return result
}
func result() -> String {
return
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
return "something"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment