feat[thread]: add mutex

This commit is contained in:
Martin Eyben 2025-03-14 18:01:09 +01:00
parent f5039ce66b
commit 70325e97ba

View File

@ -1,6 +1,7 @@
#include "thread.h" #include "thread.h"
#include "debug.h" #include "debug.h"
#include "pthread.h" #include "pthread.h"
#include <bits/pthreadtypes.h>
#include <sched.h> #include <sched.h>
@ -29,3 +30,17 @@ void thread_exit(void *retval) {
pthread_exit(retval); pthread_exit(retval);
} }
int thread_mutex_init(thread_mutex_t *mutex) {
return pthread_mutex_init((pthread_mutex_t *) mutex, NULL);
}
int thread_mutex_destroy(thread_mutex_t *mutex) {
return pthread_mutex_destroy((pthread_mutex_t *) mutex);
}
int thread_mutex_lock(thread_mutex_t *mutex) {
return pthread_mutex_lock((pthread_mutex_t * )mutex);
}
int thread_mutex_unlock(thread_mutex_t *mutex) {
return pthread_mutex_unlock((pthread_mutex_t *)mutex);
}