You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
303 B
13 lines
303 B
#ifndef COMMON_MUTEX_H
|
|
#define COMMON_MUTEX_H
|
|
|
|
#include <pthread.h>
|
|
|
|
static inline void mutex_init_reentrant(pthread_mutex_t *mutex) {
|
|
pthread_mutexattr_t attr;
|
|
pthread_mutexattr_init(&attr);
|
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
pthread_mutex_init(mutex, &attr);
|
|
}
|
|
|
|
#endif
|
|
|