-
-
Save jessicah/49ce38312ea20462165233a876f12e17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Always check the result of lock and unlock. */ | |
#define OS_ACQUIRE_LOCK(mutex) \ | |
LOCK_DEBUG_BELCH("begin ACQUIRE_LOCK...", mutex); \ | |
{ int __result = pthread_mutex_lock(mutex); \ | |
LOCK_DEBUG_BELCH("end ACQUIRE_LOCK...", mutex); \ | |
if (__result == EDEADLK) { \ | |
barf("multiple ACQUIRE_LOCK: %s %d", __FILE__,__LINE__); \ | |
} \ | |
} | |
#define OS_RELEASE_LOCK(mutex) \ | |
LOCK_DEBUG_BELCH("RELEASE_LOCK", mutex); \ | |
if (pthread_mutex_unlock(mutex) != 0) { \ | |
barf("RELEASE_LOCK: I do not own this lock: %s %d", __FILE__,__LINE__); \ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment