1 #include <assert.h>
2 #include <lib/sync/mutex.h>
3 #include <threads.h>
4 
5 static_assert(sizeof(mtx_t) == sizeof(sync_mutex_t), "mtx_t has an unexpected size");
6 
mtx_init(mtx_t * m,int type)7 int mtx_init(mtx_t* m, int type) {
8     // TODO(kulakowski) Revisit this if anyone actually needs a recursive C11 mutex.
9     if (type & mtx_recursive)
10         return thrd_error;
11 
12     *(sync_mutex_t*)&m->__i = SYNC_MUTEX_INIT;
13 
14     return thrd_success;
15 }
16