rockbox/firmware/kernel/pthread/mutex.c
Thomas Martitz d66346789c buflib: Check the validity of of handles passed to buflib_get_data() in DEBUG builds.
Change-Id: Ic274bfb4a8e1a1a10f9a54186b9173dbc0faa4c8
2014-02-02 16:59:29 +01:00

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);
}