[Mammoth] Move most classes to the mmth namespace.

This commit is contained in:
Drew Galbraith 2023-11-22 14:59:41 -08:00
parent 5f8d577948
commit 8d730c67c1
42 changed files with 130 additions and 60 deletions

View file

@ -2,6 +2,8 @@
#include <zcall.h>
namespace mmth {
Mutex::Mutex(Mutex&& other) : mutex_cap_(other.mutex_cap_) {
other.mutex_cap_ = 0;
}
@ -25,3 +27,5 @@ glcr::ErrorCode Mutex::Lock() {
glcr::ErrorCode Mutex::Release() {
return static_cast<glcr::ErrorCode>(ZMutexRelease(mutex_cap_));
}
} // namespace mmth

View file

@ -3,6 +3,8 @@
#include <glacier/status/error_or.h>
#include <ztypes.h>
namespace mmth {
class Mutex {
public:
Mutex(const Mutex&) = delete;
@ -19,3 +21,5 @@ class Mutex {
Mutex(z_cap_t mutex_cap) : mutex_cap_(mutex_cap) {}
};
} // namespace mmth

View file

@ -4,8 +4,12 @@
#include "util/debug.h"
namespace mmth {
Semaphore::Semaphore() { check(ZSemaphoreCreate(&semaphore_cap_)); }
Semaphore::~Semaphore() { check(ZCapRelease(semaphore_cap_)); }
void Semaphore::Wait() { check(ZSemaphoreWait(semaphore_cap_)); }
void Semaphore::Signal() { check(ZSemaphoreSignal(semaphore_cap_)); }
} // namespace mmth

View file

@ -2,6 +2,8 @@
#include <ztypes.h>
namespace mmth {
class Semaphore {
public:
Semaphore();
@ -13,3 +15,5 @@ class Semaphore {
private:
z_cap_t semaphore_cap_;
};
} // namespace mmth