Bug#30992 Wrong implementation of pthread_mutex_trylock()
It's not possible to use WaitForSingleObject to wait on a CRITICAL_SECTION, instead use the TryEnterCriticalSection function. - if "mutex" was already taken => return EBUSY - if "mutex" was aquired => return 0 include/config-win.h: Make windows.h define TryEnterCriticalSection mysys/my_winthread.c: Use the TryEnterCriticalSection function to implement pthread_mutex_trylock Prevent recursive behaviour by looking at the RecursionCount variable in the CRITICAL_SECTION struct and return EBUSY from function if the mutex was already locked once.
Showing
Please register or sign in to comment