Date: Thu, 19 Aug 2004 11:31:42 +0000 (UTC) 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 kern_synch.c kern_thread.c subr_sleepqueue.c src/sys/sys proc.h sleepqueue.h Message-ID: <200408191131.i7JBVgsa027339@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
jhb 2004-08-19 11:31:42 UTC FreeBSD src repository Modified files: sys/kern kern_condvar.c kern_synch.c kern_thread.c subr_sleepqueue.c sys/sys proc.h sleepqueue.h Log: Now that the return value semantics of cv's for multithreaded processes have been unified with that of msleep(9), further refine the sleepq interface and consolidate some duplicated code: - Move the pre-sleep checks for theaded processes into a thread_sleep_check() function in kern_thread.c. - Move all handling of TDF_SINTR to be internal to subr_sleepqueue.c. Specifically, if a thread is awakened by something other than a signal while checking for signals before going to sleep, clear TDF_SINTR in sleepq_catch_signals(). This removes a sched_lock lock/unlock combo in that edge case during an interruptible sleep. Also, fix sleepq_check_signals() to properly handle the condition if TDF_SINTR is clear rather than requiring the callers of the sleepq API to notice this edge case and call a non-_sig variant of sleepq_wait(). - Clarify the flags arguments to sleepq_add(), sleepq_signal() and sleepq_broadcast() by creating an explicit submask for sleepq types. Also, add an explicit SLEEPQ_MSLEEP type rather than a magic number of 0. Also, add a SLEEPQ_INTERRUPTIBLE flag for use with sleepq_add() and move the setting of TDF_SINTR to sleepq_add() if this flag is set rather than sleepq_catch_signals(). Note that it is the caller's responsibility to ensure that sleepq_catch_signals() is called if and only if this flag is passed to the preceeding sleepq_add(). Note that this also removes a sched_lock lock/unlock pair from sleepq_catch_signals(). It also ensures that for an interruptible sleep, TDF_SINTR is always set when TD_ON_SLEEPQ() is true. Revision Changes Path 1.51 +16 -39 src/sys/kern/kern_condvar.c 1.258 +16 -28 src/sys/kern/kern_synch.c 1.194 +19 -0 src/sys/kern/kern_thread.c 1.11 +23 -9 src/sys/kern/subr_sleepqueue.c 1.393 +1 -0 src/sys/sys/proc.h 1.4 +4 -1 src/sys/sys/sleepqueue.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408191131.i7JBVgsa027339>