It is not necessary that the mutex is recursive

This commit is contained in:
vemax78 2013-11-10 22:10:10 +01:00
parent db29a6228e
commit bd6e6547b7
1 changed files with 5 additions and 7 deletions

View File

@ -7,15 +7,13 @@
/* */
int capwap_lock_init(capwap_lock_t* lock) {
pthread_mutexattr_t attr;
ASSERT(lock != NULL);
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if (pthread_mutex_init(&lock->mutex, &attr) != 0)
memset(lock, 0, sizeof(capwap_lock_t));
if (pthread_mutex_init(&lock->mutex, NULL) != 0) {
return 0;
}
return 1;
}