Created
October 4, 2016 21:00
-
-
Save misbell/97f3c840a570598270fa8e406a7c60c8 to your computer and use it in GitHub Desktop.
Returning value from subsystem with DispatchQueue.sync - Swift 3.0 - October 4 2016
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
// pretending this is a subsystem | |
let holdval = HoldAValue() | |
var avalue: Int { | |
var i: Int = 0 | |
DispatchQueue.global(qos: .userInitiated).sync { | |
i = holdval.anIntValue | |
} | |
return i | |
} | |
print ("\(avalue) avalue") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment