#include <GuardedVariable.hpp>
Collaboration diagram for GuardedVariable< T >:

Public Member Functions | |
| GuardedVariable (T initialValue=0) | |
| T | inc () |
| T | dec () |
| T | value () |
| void | set (T newValue) |
| void | reset () |
Private Attributes | |
| volatile T | variable |
| pthread_mutex_t | lock |
A guarded variable contais a templatized number variable. All access to this variable is synchronized by the use of a lock.
|
||||||||||
|
Constructs a GuardedVariable object.
|
|
|||||||||
|
Decrements the guarded variable.
|
|
|||||||||
|
Increments the guarded variable.
|
|
|||||||||
|
Reset the guarded variable. |
|
||||||||||
|
Sets the guarded variable to a new value
|
|
|||||||||
|
Returns the value of the guarded variable. |
|
|||||
|
lock to prevent race conditions |
|
|||||
|
The variable to be protected |
1.3.3