[Mammoth] Create userspace mutex capability.

This commit is contained in:
Drew Galbraith 2023-10-25 19:07:36 -07:00
parent 4c04f9d561
commit 6cb0041253
3 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#pragma once
#include <glacier/status/error_or.h>
#include <ztypes.h>
class Mutex {
public:
Mutex(const Mutex&) = delete;
Mutex(Mutex&&);
Mutex& operator=(Mutex&&);
static glcr::ErrorOr<Mutex> Create();
glcr::ErrorCode Lock();
glcr::ErrorCode Release();
private:
z_cap_t mutex_cap_;
Mutex(z_cap_t mutex_cap) : mutex_cap_(mutex_cap) {}
};