• unknown's avatar
    BUG#30992 (Wrong implementation of pthread_mutex_trylock()): · 2b9b71d0
    unknown authored
    Adding support for correct handling of pthread_mutex_trylock() on Win32
    systems as well as when using the safe mutexes. 
    
    
    include/my_pthread.h:
      Adding win_pthread_mutex_trylock() function as wrapper function for
      Windows implementation of pthread_mutex_trylock().
      
      Adding flag to safe_mutex_lock() that is shall not abort if the mutex
      is already locked and instead return EBUSY since this is the POSIX
      behaviour.
    mysys/my_winthread.c:
      Added Win32 wrappper function to handle pthread_mutex_trylock().
    mysys/thr_mutex.c:
      Added parameter 'try_lock' to safe_mutex_lock() to allow it to do double-
      duty as a pthread_mutex_trylock() in addition to working as
      pthread_mutex_lock().
      
      The code needs to return EBUSY instead of throwing an error in the event
      that the mutex is re-locked (we do not have recursive mutexes), but it
      also requires some special handling to avoid race conditions when
      calling the real pthread_mutex_{lock,trylock}().
    2b9b71d0
thr_mutex.c 10.6 KB