From owner-cvs-src@FreeBSD.ORG Thu Aug 19 11:31:42 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E62316A4CE; Thu, 19 Aug 2004 11:31:42 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A6EF43D55; Thu, 19 Aug 2004 11:31:42 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i7JBVgxd027340; Thu, 19 Aug 2004 11:31:42 GMT (envelope-from jhb@repoman.freebsd.org) Received: (from jhb@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i7JBVgsa027339; Thu, 19 Aug 2004 11:31:42 GMT (envelope-from jhb) Message-Id: <200408191131.i7JBVgsa027339@repoman.freebsd.org> From: John Baldwin Date: Thu, 19 Aug 2004 11:31:42 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD 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 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2004 11:31:42 -0000 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