Files
nt-lite/code/kernel/ke_semaphore.h
T

21 lines
566 B
C

#pragma once
// ke_semaphore.h - counting semaphore
#include <stdint.h>
#include <ob_object.h>
#include <ke_spinlock.h>
#include <ke_list.h>
#include <ke_status.h>
typedef struct SEMAPHORE {
OBJECT Header;
SPINLOCK Lock;
int32_t Count;
int32_t MaxCount;
LIST_ENTRY WaitList;
} SEMAPHORE;
KSTATUS SemaphoreCreate(int32_t initial, int32_t max, SEMAPHORE **out);
KSTATUS KeWaitSemaphore(SEMAPHORE* semaphore);
KSTATUS KeTrySemaphore(SEMAPHORE* semaphore);
void KeSignalSemaphore(SEMAPHORE* semaphore);