21 lines
656 B
C
21 lines
656 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;
|
|
|
|
__declspec(dllexport) KSTATUS KeSemaphoreCreate(int32_t initial, int32_t max, SEMAPHORE **out);
|
|
__declspec(dllexport) KSTATUS KeWaitSemaphore(SEMAPHORE* semaphore);
|
|
__declspec(dllexport) KSTATUS KeTrySemaphore(SEMAPHORE* semaphore);
|
|
__declspec(dllexport) void KeSignalSemaphore(SEMAPHORE* semaphore);
|