How to get a thread ID from a Mutex object in FreeBSD / Mac OS X

I am trying to get the thread id that locks the mutex object on Mac OS X. But the mutex object on Mac OS X does not seem to have the thread id of the owner of the mutex object.

pthread_mutex_t definition on Linux:

typedef union
{
  struct __pthread_mutex_s
  {
    int __lock;
    unsigned int __count;
    int __owner;

...

} pthread_mutex_t;

pthread_mutex_t definition on Mac OS X / FreeBSD:

struct _opaque_pthread_mutex_t
{
    long __sig;
    char __opaque[__PTHREAD_MUTEX_SIZE__]; 
};

As you can see, there is no information that I can use to get the identifier of the owned mutex stream, or am I missing something ..?

On Mac OS X, how do I get the owner of a Mutex ..? I go through the pthread header files on Mac OS X and cannot do anything useful. Please shed some light on this.

, : Mac OS X?

lldb. , .

+4
1

PThread-API , .

, , pthread_mutex_lock()/pthread_mutex_unlock(), mutex.

0

Source: https://habr.com/ru/post/1542134/


All Articles