mirror of
https://github.com/switchbrew/libnx.git
synced 2025-12-30 06:48:38 +01:00
25 lines
563 B
C
25 lines
563 B
C
/**
|
|
* @file barrier.h
|
|
* @brief Barrier synchronization primitive.
|
|
* @author Yordrar
|
|
* @copyright libnx Authors
|
|
*/
|
|
#pragma once
|
|
#include "condvar.h"
|
|
#include "mutex.h"
|
|
#include "thread.h"
|
|
#include "../runtime/util/list.h"
|
|
|
|
typedef struct barrier {
|
|
List threads_registered;
|
|
List threads_waiting;
|
|
Mutex mutex;
|
|
bool isInited;
|
|
} Barrier;
|
|
|
|
void barrierInit(Barrier* b);
|
|
void barrierFree(Barrier* b);
|
|
void barrierRegister(Barrier* b, Thread* thread);
|
|
void barrierUnregister(Barrier* b, Thread* thread);
|
|
void barrierWait(Barrier* b, Thread* thread);
|