equeue posix impl: make queue mutex reentrant

pull/11342/head
Maciej Bocianski 2019-08-29 12:31:11 +02:00
parent 66da694625
commit b336f73e77
2 changed files with 8 additions and 2 deletions

View File

@ -40,7 +40,10 @@ unsigned equeue_tick(void)
// Mutex operations
int equeue_mutex_create(equeue_mutex_t *m)
{
return pthread_mutex_init(m, 0);
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
return pthread_mutex_init(m, &attr);
}
void equeue_mutex_destroy(equeue_mutex_t *m)

View File

@ -40,7 +40,10 @@ unsigned equeue_tick(void)
// Mutex operations
int equeue_mutex_create(equeue_mutex_t *m)
{
return pthread_mutex_init(m, 0);
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
return pthread_mutex_init(m, &attr);
}
void equeue_mutex_destroy(equeue_mutex_t *m)