Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
  2. dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 15ull * NSEC_PER_SEC, 1ull * NSEC_PER_SEC);
  3. dispatch_source_set_event_handler(timer, ^{
  4. NSLog(@"wakeup!");
  5.  
  6. dispatch_source_cancel(timer);
  7. });
  8. dispatch_source_set_cancel_handler(timer, ^{
  9. NSLog(@"cancel");
  10.  
  11. });
  12. dispatch_resume(timer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement