• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: recursive mutexes in Lion?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: recursive mutexes in Lion?
      • From: "Stephen J. Butler" <email@hidden>
    • Re: recursive mutexes in Lion?
      • From: Greg Parker <email@hidden>
References: 
 >recursive mutexes in Lion? (From: Jack Howarth <email@hidden>)

  • Prev by Date: recursive mutexes in Lion?
  • Next by Date: Re: recursive mutexes in Lion?
  • Previous by thread: recursive mutexes in Lion?
  • Next by thread: Re: recursive mutexes in Lion?
  • Index(es):
    • Date
    • Thread