Date: Tue, 6 Apr 2004 12:17:47 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern kern_condvar.c src/sys/sys condvar.h Message-ID: <200404061917.i36JHlTU036983@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404061917.i36JHlTU036983>