Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this source is in the public domain
- #import "semaphore_scope.h"
- dispatch_semaphore_t foo_dsem_; // initialized elsewhere
- int foo() {
- DSemaphoreScope semscope(foo_dsem_);
- // critical section
- if (!something) {
- return 0;
- // dispatch_semaphore_signal implicitly called before returning
- }
- // do something else here maybe
- return 1;
- // dispatch_semaphore_signal implicitly called before returning
- }
Add Comment
Please, Sign In to add comment