Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 2009 12:08:34 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        =?koi8-r?Q?=ED=C9=C8=C1=C9=CC_=EB=C9=D0=C1?= <msnkipa@mail.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: pthread_mutexattr_getprioceiling error?
Message-ID:  <Pine.GSO.4.64.0906131158130.7673@sea.ntplx.net>
In-Reply-To: <E1MFTlI-0008Sd-00.msnkipa-mail-ru@f60.mail.ru>
References:  <E1MFTlI-0008Sd-00.msnkipa-mail-ru@f60.mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
  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 <pthread.h>
> #include <iostream>
>
> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0906131158130.7673>