#include <Synchronized.h>
Public Member Functions | |
Synchronized (SEM_ID) | |
virtual | ~Synchronized (void) |
Synchronized::Synchronized | ( | SEM_ID | semaphore | ) |
Synchronized class deals with critical regions. Declare a Synchronized object at the beginning of a block. That will take the semaphore. When the code exits from the block it will call the destructor which will give the semaphore. This ensures that no matter how the block is exited, the semaphore will always be released. Use the CRITICAL_REGION(SEM_ID) and END_REGION macros to make the code look cleaner (see header file)
semaphore | The semaphore controlling this critical region. |
Synchronized::~Synchronized | ( | void | ) | [virtual] |
Syncronized destructor. This destructor frees the semaphore ensuring that the resource is freed for the block containing the Synchronized object.