#include "src/threads/mtx_init.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/mutex.h"
#include <threads.h>
namespace LIBC_NAMESPACE_DECL {
static_assert(sizeof(Mutex) <= sizeof(mtx_t),
"The public mtx_t type cannot accommodate the internal mutex "
"type.");
LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) {
auto err = Mutex::init(reinterpret_cast<Mutex *>(m), type & mtx_timed,
type & mtx_recursive, false,
false);
return err == MutexError::NONE ? thrd_success : thrd_error;
}
}