From owner-freebsd-threads@FreeBSD.ORG Fri Feb 27 17:28:58 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 D267616A4CE; Fri, 27 Feb 2004 17:28:58 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDD6343D1D; Fri, 27 Feb 2004 17:28:58 -0800 (PST) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (davidxu@localhost [127.0.0.1]) i1S1Svbv010051; Fri, 27 Feb 2004 17:28:58 -0800 (PST) (envelope-from davidxu@freebsd.org) Message-ID: <403FEE22.2040507@freebsd.org> Date: Sat, 28 Feb 2004 09:25:54 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031208 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Baldwin References: <200402271455.38197.jhb@FreeBSD.org> In-Reply-To: <200402271455.38197.jhb@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: threads@freebsd.org Subject: Re: 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: Sat, 28 Feb 2004 01:28:58 -0000 John Baldwin wrote: > 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. Yes, I think cv and msleep code should be synchronized. > Secondly, cv's don't really handle > td_intrval very well at all. It is a bug. :-( > It has one hard-coded override for the P_EXIT > case but that's it. > I think it should includes P_SINGLE_EXIT, P_WEXIT is set when there is only one thread in process (see exit1() ). both msleep and cv are incorrect in the case. Are you fixing these bugs ? David Xu