cvs commit: src/sys/kern kern_condvar.c src/sys/sys condvar.h

John Baldwin jhb at FreeBSD.org
Tue Apr 6 12:19:04 PDT 2004


jhb         2004/04/06 12:17:46 PDT

  FreeBSD src repository

  Modified files:
    sys/kern             kern_condvar.c 
    sys/sys              condvar.h 
  Log:
  Associate a simple count of waiters with each condition variable.  The
  count is protected by the mutex that protects the condition, so the count
  does not require any extra locking or atomic operations.  It serves as an
  optimization to avoid calling into the sleepqueue code at all if there are
  no waiters.
  
  Note that the count can get temporarily out of sync when threads sleeping
  on a condition variable time out or are aborted.  However, it doesn't hurt
  to call the sleepqueue code for either a signal or a broadcast when there
  are no waiters, and the count is never out of sync in the opposite
  direction unless we have more than INT_MAX sleeping threads.
  
  Revision  Changes    Path
  1.48      +13 -2     src/sys/kern/kern_condvar.c
  1.11      +5 -1      src/sys/sys/condvar.h


More information about the cvs-src mailing list