Semaphore: Event Signalling
Another use for a semaphore is event signaling; assume one thread monitors a temperature, and another thread can decrease the heat coming out of a burner.
If we define a semaphore unit as meaning “temperature is too high”, the measuring thread can signal this condition by releasing a unit to this semaphore.
For the burner thread receiving a unit (coming out of WaitForRtSemaphore), this unit then indicates that the heat now should be decreased.
(You may need another semaphore to increase the heat…)