I'm trying to get the Thread ID which called the lock on the mutex object in Mac OS X. But the mutex object in Mac OS X doesn't seem to have the owner thread id of the mutex object.
definition of pthread_mutex_t in Linux :
typedef union
{
struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
int __owner;
...
} pthread_mutex_t;
definition of pthread_mutex_t in Mac OS X/FreeBSD :
struct _opaque_pthread_mutex_t
{
long __sig;
char __opaque[__PTHREAD_MUTEX_SIZE__];
};
As you can see there seems to be no info,which i can make use of to get the owning thread id of the mutex, or am i missing something ..?
In Mac OS X, how do i get the Mutex's owner ..? I have been going thru the pthread header files in Mac OS X and couldn't make anything useful. Please shed some light on this.
I Know there is a similar question : How can I debug mutex issues on Mac OS X?
But it's neither answered and i don't want to use lldb. I want the mutex's owner in my code itself to avoid recursive locks.