Locking pthread_mutex_t struct:lock代表什么?

Locking pthread_mutex_t struct:lock代表什么?,locking,pthreads,posix,mutex,mutual-exclusion,Locking,Pthreads,Posix,Mutex,Mutual Exclusion,我正在查看pthreadtypes.h文件中的pthread\u mutex\t结构。“锁”代表什么?它是否像分配给互斥锁的锁号 typedef union { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; #if __WORDSIZE == 64 unsigned int __nusers; #endif /* KIN

我正在查看pthreadtypes.h文件中的pthread\u mutex\t结构。“锁”代表什么?它是否像分配给互斥锁的锁号

typedef union
{
  struct __pthread_mutex_s
  {
     int __lock;
     unsigned int __count;
     int __owner;
     #if __WORDSIZE == 64
     unsigned int __nusers;
     #endif
    /* KIND must stay at this position in the structure to maintain
     binary compatibility.  */
     int __kind;
     #if __WORDSIZE == 64
     int __spins;
     __pthread_list_t __list;
     # define __PTHREAD_MUTEX_HAVE_PREV 1
     #else
     unsigned int __nusers;
     __extension__ union
    {
      int __spins;
      __pthread_slist_t __list;
    };
    #endif
  } __data;
 char __size[__SIZEOF_PTHREAD_MUTEX_T];
 long int __align;

}pthread_mutex_t

在Linux上,将
\uuuuu数据
\uuuu锁
成员
用作futex对象。根据您所看到的体系结构,以下许多细节可能有所不同:

请参阅
pthread\u mutex\u lock.c
代码,了解pthread mutex的高级锁定函数-
\uuuhread\u mutex\u lock()
,它通常会调用
LLL\u mutex\u lock()
以及
LLL\u mutex\u lock()和friends的定义,它们最终会调用
LLL\u lock()
,等等。,在
lowlevellock.h

lll\u lock()
宏依次调用
lll\u lock\u wait\u private()
,调用
lll\u futex\u wait()
,从而进行
sys\u futex
系统调用