From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 13 16:08:36 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F582106564A for ; Sat, 13 Jun 2009 16:08:36 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id EFA568FC0C for ; Sat, 13 Jun 2009 16:08:35 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id n5DG8YSO028729; Sat, 13 Jun 2009 12:08:34 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Sat, 13 Jun 2009 12:08:34 -0400 (EDT) Date: Sat, 13 Jun 2009 12:08:34 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: =?koi8-r?Q?=ED=C9=C8=C1=C9=CC_=EB=C9=D0=C1?= In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-758783491-1244909314=:7673" Cc: freebsd-hackers@freebsd.org Subject: Re: pthread_mutexattr_getprioceiling error? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jun 2009 16:08:36 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---559023410-758783491-1244909314=:7673 Content-Type: TEXT/PLAIN; charset=koi8-r; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 13 Jun 2009, =ED=C9=C8=C1=C9=CC =EB=C9=D0=C1 wrote: > Next little program: > #include > #include > > int main() > { > pthread_mutexattr_t t; > if (pthread_mutexattr_init(&t)) return 1; > int i; > std::cout << pthread_mutexattr_getprioceiling(&t, &i) << std::endl= ; > } > > always print 22. It means that pthread_mutexattr_getprioceiling always=20 > fails with EINVAL. Under Linux this example works fine, but under=20 > FreeBSD 7.2 it does`n work. Is it a bug in FreeBSD thread library or=20 > it ai my misunderstanding? Well, you can't get the priority ceiling of a _mutex_ if it the protocol is PTHREAD_PRIO_NONE. See the POSIX spec, excerpt here (pthread_mutex_getprioceiling): These functions shall fail if: [EINVAL] The protocol attribute of mutex is PTHREAD_PRIO_NONE. POSIX makes no mention of this for operations on a mutex attribute, but I have no idea why it wouldn't have the same error returned under similar conditions. Why would you want to get the priority ceiling of a mutex attribute that is not PTHREAD_PRIO_PROTECT? What value could the implementation return in this case anyway, it really doesn't make sense? --=20 DE ---559023410-758783491-1244909314=:7673--