#pragma once // ke_semaphore.h - counting semaphore #include #include #include #include #include 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);