nn::os::LightSemaphore Class

Header file: nn/os.h

Syntax

class LightSemaphore

Description

Synchronization mechanism for mutual exclusion of the number of resources between threads.

This function has an internal counter that is incremented and decremented in order to manage the number of resources. If the counter value is 0, it is possible to wait until it becomes 1 or greater.

The nn::os::LightSemaphore class is superior to the nn::os::Semaphore class and should therefore be used in normal cases. Its only disadvantage is the fact that it is unable to wait for multiple synchronization objects simultaneously.

All member functions of this class are thread-safe except for the Initialize and Finalize functions.

Member Functions

Initialization/Finalization
LightSemaphore Constructor.
Initialize Performs initialization.
Finalize Performs finalization.
Obtaining Debug Info
GetCount Gets the maximum counter value that was specified by either the constructor or Initialize.
Counter Operations and Blocking
Acquire Decrements the counter value by one.
TryAcquire Tries to decrement the counter value by one.
Release Adds to the counter value.

Revision History

2010/06/14
Initial version.

CONFIDENTIAL