|
|
@ -83,8 +83,10 @@ class CriticalSection {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
CriticalSection() {
|
|
|
|
CriticalSection() {
|
|
|
|
pthread_mutexattr_t mutex_attribute;
|
|
|
|
pthread_mutexattr_t mutex_attribute;
|
|
|
|
|
|
|
|
pthread_mutexattr_init(&mutex_attribute);
|
|
|
|
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
|
|
|
|
pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_RECURSIVE);
|
|
|
|
pthread_mutex_init(&mutex_, &mutex_attribute);
|
|
|
|
pthread_mutex_init(&mutex_, &mutex_attribute);
|
|
|
|
|
|
|
|
pthread_mutexattr_destroy(&mutex_attribute);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~CriticalSection() {
|
|
|
|
~CriticalSection() {
|
|
|
|
pthread_mutex_destroy(&mutex_);
|
|
|
|
pthread_mutex_destroy(&mutex_);
|
|
|
|