From owner-freebsd-threads@FreeBSD.ORG Sat Dec 6 10:40:07 2003 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 DFBAD16A4CF; Sat, 6 Dec 2003 10:40:07 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1ACAF43FBF; Sat, 6 Dec 2003 10:40:06 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id hB6Ie5ml021190; Sat, 6 Dec 2003 13:40:05 -0500 (EST) Date: Sat, 6 Dec 2003 13:40:05 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: deischen@freebsd.org In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: pthread_mutex_trylock() should never block 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, 06 Dec 2003 18:40:08 -0000 On Sat, 6 Dec 2003, Daniel Eischen wrote: > On Sat, 6 Dec 2003, Igor Sysoev wrote: > > > > SUSv2 states: > > [ http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_mutex_lock.html ] > > > > -------- > > The function pthread_mutex_trylock() is identical to pthread_mutex_lock() > > except that if the mutex object referenced by mutex is currently locked > > (by any thread, including the current thread), the call returns immediately. > > The low-level locks are necessary (at least in libpthread implementation) > to safely test the mutex for ownership. And not only that, but the low-level locks are also necessary to take the mutex if it is not owned. -- Dan Eischen