pWaitSemaphore
pWaitSemaphore is a synchronization primitive used in multithreaded programming. It acts as a signaling mechanism that allows one or more threads to wait for a signal from another thread. A semaphore is typically initialized with a non-negative integer value representing the number of available "permits" or "signals". When a thread calls pWaitSemaphore, it attempts to acquire a permit. If permits are available, the semaphore's internal count is decremented, and the thread proceeds. If no permits are available, the thread is blocked and placed in a waiting queue until a permit becomes available.
Another operation, often referred to as `pSignalSemaphore` or `pPostSemaphore`, releases a permit. When this operation is
pWaitSemaphore and its corresponding signaling operation are fundamental building blocks for managing concurrent access to shared