Re: Custom data formatter for pthread_mutex_t?
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