mirror of
https://github.com/switchbrew/libnx.git
synced 2025-12-30 06:48:38 +01:00
23 lines
415 B
C
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 *);
|