• 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: Custom data formatter for pthread_mutex_t?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom data formatter for pthread_mutex_t?


  • Subject: Re: Custom data formatter for pthread_mutex_t?
  • From: Steve Checkoway <email@hidden>
  • Date: Fri, 17 Aug 2007 00:40:06 -0700

I looked this up earlier but got bored so I didn't write the custom data formatter. Here's the relevant structure though.

typedef struct _pthread_mutex
{
long sig; /* Unique signature for this structure */
pthread_lock_t lock; /* Used for internal mutex on structure */
u_int32_t waiters; /* Count of threads waiting for this mutex */
pthread_t owner; /* Which thread has this mutex locked */
semaphore_t sem; /* Semaphore used for waiting */
u_int32_t protocol:2, /* protocol */
type:2, /* mutex type */
rfu:12,
lock_count:16;
struct _pthread_mutex *next, *prev; /* List of other mutexes he owns */
struct _pthread_cond *busy; /* List of condition variables using this mutex */
int16_t prioceiling;
int16_t priority; /* Priority to restore when mutex unlocked */
semaphore_t order;
} pthread_mutex_t;


If the mutex is nonrecursive (which, by the way, would break the example function written earlier, I believe), then you can just look at owner to determine if it's in use. Otherwise (and probably always), you can look at lock_count to determine if it's currently locked.

This is likely not guaranteed to change, but as long as you're only debugging, there's probably no harm in using it.

--
Steve Checkoway



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Custom data formatter for pthread_mutex_t? (From: Cem Karan <email@hidden>)
 >Re: Custom data formatter for pthread_mutex_t? (From: Alastair Houghton <email@hidden>)
 >RE: Custom data formatter for pthread_mutex_t? (From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>)
 >Re: Custom data formatter for pthread_mutex_t? (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: how to disable floating point exceptions/arithmetic exceptions?
  • Next by Date: XCode 3....
  • Previous by thread: Re: Custom data formatter for pthread_mutex_t?
  • Next by thread: Re: Custom data formatter for pthread_mutex_t?
  • Index(es):
    • Date
    • Thread