Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save demigod19892012/5311169 to your computer and use it in GitHub Desktop.
Save demigod19892012/5311169 to your computer and use it in GitHub Desktop.
[IOS] Use dispatch_once within GCD
dispatch_queue_t get_my_background_queue()
{
static dispatch_once_t once;
static dispatch_queue_t my_queue;
dispatch_once(&once, ^{
my_queue = dispatch_queue_create("com.example.background", NULL);
});
return my_queue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment