2023-11-22 13:45:04 -08:00
|
|
|
#include "sync/semaphore.h"
|
2023-11-22 10:55:40 -08:00
|
|
|
|
|
|
|
#include <zcall.h>
|
|
|
|
|
2023-11-22 14:39:27 -08:00
|
|
|
#include "util/debug.h"
|
2023-11-22 10:55:40 -08:00
|
|
|
|
2023-11-22 14:59:41 -08:00
|
|
|
namespace mmth {
|
|
|
|
|
2023-11-22 10:55:40 -08:00
|
|
|
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_)); }
|
2023-11-22 14:59:41 -08:00
|
|
|
|
|
|
|
} // namespace mmth
|