Skip to content

Instantly share code, notes, and snippets.

@xissburg
Created May 14, 2015 23:23
Show Gist options
  • Save xissburg/e962d830acb73c38c4a7 to your computer and use it in GitHub Desktop.
Save xissburg/e962d830acb73c38c4a7 to your computer and use it in GitHub Desktop.
@property (nonatomic, strong) dispatch_source_t serverPollTimer;
/* ___ */
__weak typeof(self) weakSelf = self;
self.serverPollTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
dispatch_source_set_timer(self.serverPollTimer, dispatch_walltime(NULL, 7*NSEC_PER_SEC), 7*NSEC_PER_SEC, 1e8);
dispatch_source_set_event_handler(self.serverPollTimer, ^{
[weakSelf updateCurrentJobState];
});
dispatch_resume(self.serverPollTimer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment