[Mammoth] Add a user-space semaphore object.
This commit is contained in:
parent
da3901e104
commit
4c2492e985
3 changed files with 27 additions and 0 deletions
11
lib/mammoth/src/semaphore.cpp
Normal file
11
lib/mammoth/src/semaphore.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include "mammoth/semaphore.h"
|
||||
|
||||
#include <zcall.h>
|
||||
|
||||
#include "mammoth/debug.h"
|
||||
|
||||
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_)); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue