Created
May 7, 2015 21:04
-
-
Save farktronix/c1032caaeafeb50d823b to your computer and use it in GitHub Desktop.
dispatch_source_type_data_or rocks
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
_setupQueue = dispatch_queue_create("com.fark.setup", DISPATCH_QUEUE_SERIAL); | |
_setupSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_DATA_OR, 0, 0, _setupQueue); | |
dispatch_source_set_event_handler(_setupSource, ^{ | |
[weakSelf _reload]; | |
}); | |
dispatch_resume(_setupSource); | |
... | |
- (void)_signalAccountReload { | |
dispatch_source_merge_data(self.setupSource, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obligatory Swift version: