Use dispatch_once within GCD


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. dispatch_queue_t get_my_background_queue()
  2. {
  3. static dispatch_once_t once;
  4. static dispatch_queue_t my_queue;
  5. dispatch_once(&once, ^{
  6. my_queue = dispatch_queue_create("com.example.background", NULL);
  7. });
  8. return my_queue;
  9. }
  10.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.