Skip to content

Instantly share code, notes, and snippets.

@cqa02303
Created September 5, 2011 01:28
Show Gist options
  • Save cqa02303/1193858 to your computer and use it in GitHub Desktop.
Save cqa02303/1193858 to your computer and use it in GitHub Desktop.
dispatch_syncに絶望してこんな事をしている
__block dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
dispatch_async(queue, ^{
// hogehoge
// ここに処理を書く
//
dispatch_semaphore_signal(semaphore);
});
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_release(semaphore);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment