Well known multithreading synchronization tool. In U++, it is primarily used to block and release thread execution. Semaphore has an internal counter, initially initialized to zero. Wait operation blocks thread execution as long as counter is zero, then decreases it by one. Release operation increases counter by 1.
If internal semaphore counter is zero, waits (blocks calling thread) until some other thread increases this counter by 1 calling the Release method. Before returning, decreases counter by 1.
Increases internal counter by 1.
Initializes internal counter to 0.
Variant of Semaphore that can be used as static or global variable without the need of initialization - it has no constructor and correctly performs the first initialization when any of methods is called. That avoids problems with initialization order or multithreaded initialization issues.
Returns the Semaphore instance.
Call respective methods of Semaphore instance.