mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
21 lines
437 B
C
21 lines
437 B
C
#include <pthread.h>
|
|
#include "kernel.h"
|
|
|
|
void mutex_init(struct mutex *m)
|
|
{
|
|
pthread_mutexattr_t attr;
|
|
pthread_mutexattr_init(&attr);
|
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
pthread_mutex_init(&m->mutex, &attr);
|
|
pthread_mutexattr_destroy(&attr);
|
|
}
|
|
|
|
void mutex_lock(struct mutex *m)
|
|
{
|
|
pthread_mutex_lock(&m->mutex);
|
|
}
|
|
|
|
void mutex_unlock(struct mutex *m)
|
|
{
|
|
pthread_mutex_unlock(&m->mutex);
|
|
}
|