From owner-freebsd-threads@FreeBSD.ORG Wed Jul 17 22:50:47 2013 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 44BC3EC0 for ; Wed, 17 Jul 2013 22:50:47 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from av-tac-rtp.cisco.com (av-tac-rtp.cisco.com [64.102.19.209]) by mx1.freebsd.org (Postfix) with ESMTP id F41EF119 for ; Wed, 17 Jul 2013 22:50:46 +0000 (UTC) X-TACSUNS: Virus Scanned Received: from chook.cisco.com (localhost.cisco.com [127.0.0.1]) by av-tac-rtp.cisco.com (8.13.8+Sun/8.13.8) with ESMTP id r6HMeF3h029812 for ; Wed, 17 Jul 2013 18:40:15 -0400 (EDT) Received: from dhcp-10-150-54-149.cisco.com (dhcp-10-150-54-149.cisco.com [10.150.54.149]) by chook.cisco.com (8.13.8+Sun/8.13.8) with ESMTP id r6HMeFC4026843; Wed, 17 Jul 2013 18:40:15 -0400 (EDT) Message-ID: <51E71D4F.5030502@marcuscom.com> Date: Wed, 17 Jul 2013 18:40:15 -0400 From: Joe Marcus Clarke User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: freebsd-threads@freebsd.org Subject: Mutexes and error checking Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Koop Mast X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jul 2013 22:50:47 -0000 It seems we might have a discrepancy between the way our pthread implementation works compared to Linux. If a mutex is set to NORMAL type and one goes to unlock it, EPERM is returned unless the current thread is the mutex owner. While this sounds perfectly sane, it appears Linux only returns EPERM if the mutex type is ERRORCHECK. We are seeing some problems in ported code because of this. As a suggestion, if people agree, would it be possible to emulate the behavior of Linux and only return EPERM if the mutex is of type ERRORCHECK or RECURSVIE? Joe -- PGP Key : http://www.marcuscom.com/pgp.asc