libnx/nx/include/switch/kernel/semaphore.h
Unknown e8fc3dbe13 Changed implementation to match SciresM version
Now similar to SciresM HosSemaphore class
2018-06-26 18:49:05 -04:00

23 lines
415 B
C

/**
* @file semaphore.h
* @brief Thread synchronization based on Mutex.
* @author Kevoot
* @copyright libnx Authors
*/
#pragma once
#include "mutex.h"
#include "condvar.h"
typedef struct Semaphore
{
CondVar condvar;
Mutex mutex;
u64 count;
} Semaphore;
void semaphoreInit(Semaphore *, u64);
void semaphoreSignal(Semaphore *);
void semaphoreWait(Semaphore *);
bool semaphoreTryWait(Semaphore *);