Re: recursive mutexes in Lion?
Re: recursive mutexes in Lion?
- Subject: Re: recursive mutexes in Lion?
- From: Greg Parker <email@hidden>
- Date: Tue, 31 Jan 2012 13:26:38 -0800
On Jan 31, 2012, at 11:58 AM, Jack Howarth <email@hidden> wrote:
> The upcoming FSF gcc 4.7 release seems to have uncovered that the claimed
> recursive mutex support in pthread.h for Lion is broken...
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51906
>
> ---- pthread_test.C ----
> #include <pthread.h>
> #include <stdio.h>
>
> /* int pthread_mutexatttr_settype(pthread_mutexattr_t *attr, int type); */
>
> int main()
> {
> /* or PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */
> pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> pthread_mutexattr_t mta;
>
> /* pthread_mutexattr_init(&mta); */
> /* or PTHREAD_MUTEX_RECURSIVE_NP */
> printf(" returned %d\n",pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE));
> printf(" returned %d\n",pthread_mutex_trylock(&mutex));
> }
Why is the call to pthread_mutexattr_init() commented out? Does it work when you call pthread_mutexattr_init() first?
I would not be surprised if pthread_mutexattr_settype() fails with EINVAL when given an uninitialized attr variable.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden