1#include <assert.h>
2#include <runtime/mutex.h>
3#include <threads.h>
4
5static_assert(sizeof(mtx_t) == sizeof(zxr_mutex_t), "mtx_t has an unexpected size");
6
7int 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    *(zxr_mutex_t*)&m->__i = ZXR_MUTEX_INIT;
13
14    return thrd_success;
15}
16