feat[thread]: add mutex
This commit is contained in:
parent
f5039ce66b
commit
70325e97ba
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user