From owner-cvs-all Sat Mar 15 1:12:54 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9971D37B404; Sat, 15 Mar 2003 01:12:49 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DE9743F75; Sat, 15 Mar 2003 01:12:48 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h2F9CjIX026112; Sat, 15 Mar 2003 01:12:45 -0800 (PST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h2F9Cimi026111; Sat, 15 Mar 2003 01:12:44 -0800 (PST) (envelope-from das@FreeBSD.ORG) Date: Sat, 15 Mar 2003 01:12:44 -0800 From: David Schultz To: David Xu Cc: John Baldwin , cvs-all@FreeBSD.ORG, cvs-src@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libpthread/thread thr_rwlock.c Message-ID: <20030315091244.GB25766@HAL9000.homeunix.com> Mail-Followup-To: David Xu , John Baldwin , cvs-all@FreeBSD.org, cvs-src@FreeBSD.org, src-committers@FreeBSD.org References: <200303150347.h2F3lLjK069888@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200303150347.h2F3lLjK069888@freefall.freebsd.org> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake David Xu : > This design prevents a thread to get a reader lock recursively when > there is a writter blocked on a rwlock. You're right in that the standard blesses the practice of a reader recursing on a lock. Glancing briefly at the code, it looks like we presently deadlock if a writer is waiting. However, the fix is not so trivial. Writers *must* be given priority over readers within a bounded amount of time or they will be starved. Consider what happens when you have a neverending stream of readers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message