cvs commit: src/lib/libpthread/thread thr_mutex.c

David Xu davidxu at
Wed Sep 24 05:52:58 PDT 2003

davidxu     2003/09/24 05:52:57 PDT

  FreeBSD src repository

  Modified files:
    lib/libpthread/thread thr_mutex.c 
  As comments in _mutex_lock_backout state, only current thread
  can clear the pointer to mutex, not the thread doing mutex
  handoff. Because _mutex_lock_backout does not hold scheduler
  lock while testing THR_FLAGS_IN_SYNCQ and then reading mutex
  pointer, it is possible mutex owner begin to unlock and
  handoff the mutex to the current thread, and mutex pointer
  will be cleared to NULL before current thread reading it, so
  current thread will end up with deferencing a NULL pointer,
  Fix the race by making mutex waiters to clear their mutex pointers.
  While I am here, also save inherited priority in mutex for
  PTHREAD_PRIO_INERIT mutex in mutex_trylock_common just like what
  we did in mutex_lock_common.
  Revision  Changes    Path
  1.42      +4 -6      src/lib/libpthread/thread/thr_mutex.c

More information about the cvs-src mailing list