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>
index | next in thread | previous in thread | raw e-mail
On Sat, 13 Jun 2009, νΙΘΑΙΜ λΙΠΑ 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
> fails with EINVAL. Under Linux this example works fine, but under
> FreeBSD 7.2 it does`n work. Is it a bug in FreeBSD thread library or
> 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?
--
DE
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0906131158130.7673>
