几个重要的函数:
#include
int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutex_t *restrict attr); //初始化mutex
int pthread_mutex_destroy(pthread_mutex_t *mutex); //如果mutex是动态分配的,则释放内存前调用此函数。
int pthread_mutex_lock(pthread_mutex_t *mutex); //加锁
int pthread_mutex_tryloc
1