Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
- dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 15ull * NSEC_PER_SEC, 1ull * NSEC_PER_SEC);
- dispatch_source_set_event_handler(timer, ^{
- NSLog(@"wakeup!");
- dispatch_source_cancel(timer);
- });
- dispatch_source_set_cancel_handler(timer, ^{
- NSLog(@"cancel");
- });
- dispatch_resume(timer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement