From owner-freebsd-threads@FreeBSD.ORG Fri Feb 27 11:54:16 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7842A16A4CE for ; Fri, 27 Feb 2004 11:54:16 -0800 (PST) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 20CB143D45 for ; Fri, 27 Feb 2004 11:54:16 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 23066 invoked from network); 27 Feb 2004 19:54:15 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 27 Feb 2004 19:54:15 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i1RJsC28058047 for ; Fri, 27 Feb 2004 14:54:12 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: threads@FreeBSD.org Date: Fri, 27 Feb 2004 14:55:38 -0500 User-Agent: KMail/1.6 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200402271455.38197.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx Subject: Proper algorithm for return values from sleep X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2004 19:54:16 -0000 As part of my sleep queue work, I found that msleep() and the cv_wait() functions have differing semantics for return vales. It appears that at least some of the early changes KSE made to msleep() were ported to cv's but not later cleanups. Specifically, in msleep(), if we are awakened while checking for signals but we didn't find a signal, we prefer a timeout-related return value over a signal-related value. Secondly, cv's don't really handle td_intrval very well at all. It has one hard-coded override for the P_EXIT case but that's it. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org