From owner-freebsd-threads@FreeBSD.ORG Mon Feb 4 11:29:20 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BD6C16A418; Mon, 4 Feb 2008 11:29:20 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 1AA2413C467; Mon, 4 Feb 2008 11:29:19 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 407E1207E; Mon, 4 Feb 2008 12:29:09 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.2/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 2C7A02049; Mon, 4 Feb 2008 12:29:09 +0100 (CET) Received: by ds4.des.no (Postfix, from userid 1001) id 166A0844A0; Mon, 4 Feb 2008 12:29:09 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Attilio Rao" References: <200802032238.m13McAbf065324@repoman.freebsd.org> <86d4rdgehd.fsf@ds4.des.no> <3bbf2fe10802040318q456556e4g8c63299ab67c71e8@mail.gmail.com> Date: Mon, 04 Feb 2008 12:29:09 +0100 In-Reply-To: <3bbf2fe10802040318q456556e4g8c63299ab67c71e8@mail.gmail.com> (Attilio Rao's message of "Mon\, 4 Feb 2008 12\:18\:37 +0100") Message-ID: <868x21gdtm.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, threads@freebsd.org Subject: Re: cvs commit: src/include pthread_np.h src/lib/libthr pthread.map src/lib/libthr/thread thr_mutex.c X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2008 11:29:20 -0000 "Attilio Rao" writes: > Dag-Erling Sm=C3=B8rgrav writes: > > I'm having second thoughts about this one. There is a significant > > risk of false positives if the mutex is currently locked by another > > thread. I'm wondering whether to a) change the implementation so it > > only returns true if the mutex is owned by the current thread, or b) > > change the interface so you can specify a specific thread, or NULL > > for "any". > Please don't do the latter. Semantically the right thing to do here > is to assert if the curthread owns the lock or not. Any lock should > not be interested on what is the state in regard of other locks. Thank you. That was my thought as well, but I didn't want to exclude the alternative without discussion. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no