diff options
Diffstat (limited to 'src/libtools/threads.c')
| -rw-r--r-- | src/libtools/threads.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c index 1076b3e2..4fd26bf9 100644 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -1281,3 +1281,16 @@ int checkUnlockMutex(void* m) } return 0; } + +int checkNolockMutex(void* m) +{ + pthread_mutex_t* mutex = (pthread_mutex_t*)m; + int ret = pthread_mutex_trylock(mutex); + if(ret==0) { + pthread_mutex_unlock(mutex); + return 0; + } + if(ret == EDEADLK) + return 1; + return 0; +} |