32位和64位平台锁大小比较

mutex_text.c:

#include "pthread.h"

#include "stdlib.h"
#include "stdio.h"

int main()
{
   printf("Mutex:%d\nSpin:%d\nRwLock:%d\n",sizeof(pthread_mutex_t),sizeof(pthread_spinlock_t),sizeof(pthread_rwlock_t));
    return 0;

}

32位平台:

Mutex:24
Spin:4
RwLock:32


64位平台:

Mutex:40
Spin:4
RwLock:56

附:makefile

all:
    gcc mutex_text.c -o mutex_text -lpthread
clean:
    rm mutex_text

你可能感兴趣的:(32位和64位平台锁大小比较)