cvs commit: src/lib/libthr/thread thr_exit.c thr_private.h thr_rwlock.c

Mike Makonnen mtm at FreeBSD.org
Mon Jan 19 06:52:08 PST 2004


mtm         2004/01/19 06:51:45 PST

  FreeBSD src repository

  Modified files:
    lib/libthr/thread    thr_exit.c thr_private.h thr_rwlock.c 
  Log:
  Implement reference counting of read-write locks. This uses
  a list in the thread structure to keep track of the locks and
  how many times they have been locked. This list is checked
  on every lock and unlock. The traversal through the list is
  O(n). Most applications don't hold so many locks at once that
  this will become a problem. However, if it does become a problem
  it might be a good idea to review this once libthr is
  off probation and in the optimization cycle.
  This fixes:
          o deadlock when a thread tries to recursively acquire a
            read lock when a writer is waiting on the lock.
          o a thread could previously successfully unlock a lock it did not own
          o deadlock when a thread tries to acquire a write lock on
            a lock it already owns for reading or writing [ this is admittedly
            not required by POSIX, but is nice to have ]
  
  Revision  Changes    Path
  1.11      +6 -0      src/lib/libthr/thread/thr_exit.c
  1.29      +16 -0     src/lib/libthr/thread/thr_private.h
  1.4       +133 -8    src/lib/libthr/thread/thr_rwlock.c


More information about the cvs-all mailing list