From owner-freebsd-threads@FreeBSD.ORG Fri Feb 13 07:51:00 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 882B616A4CE for ; Fri, 13 Feb 2004 07:51:00 -0800 (PST) Received: from smtp.des.no (flood.des.no [217.116.83.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 58E4F43D1F for ; Fri, 13 Feb 2004 07:51:00 -0800 (PST) (envelope-from des@des.no) Received: by smtp.des.no (Pony Express, from userid 666) id 481A95309; Fri, 13 Feb 2004 16:50:59 +0100 (CET) Received: from dwp.des.no (des.no [80.203.228.37]) by smtp.des.no (Pony Express) with ESMTP id E2CF85308; Fri, 13 Feb 2004 16:50:52 +0100 (CET) Received: by dwp.des.no (Postfix, from userid 2602) id CD41833C6F; Fri, 13 Feb 2004 16:50:52 +0100 (CET) To: Craig Rodrigues References: <20040213150727.GA79077@crodrigues.org> From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=) Date: Fri, 13 Feb 2004 16:50:52 +0100 In-Reply-To: <20040213150727.GA79077@crodrigues.org> (Craig Rodrigues's message of "Fri, 13 Feb 2004 10:07:27 -0500") Message-ID: User-Agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on flood.des.no X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=AWL autolearn=no version=2.63 cc: threads@freebsd.org Subject: Re: checking lock ownership 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, 13 Feb 2004 15:51:00 -0000 Craig Rodrigues writes: > On Fri, Feb 13, 2004 at 12:46:14PM +0100, Dag-Erling Sm?rgrav wrote: > > Is there any way, either in POSIX or in FreeBSD, to check if a given > > pthread_mutex_t is owned by the current thread? > One way is to try unlock it with pthread_mutex_unlock(). > If that fails, and errno =3D=3D EPERM, then the current thread > doesn't own the mutex. I can't believe you even consider that as an option... DES --=20 Dag-Erling Sm=F8rgrav - des@des.no