#include <CeylanSynchronized.h>


Public Member Functions | |
| Synchronized (X value) | |
| Value assigned constructor. | |
| Synchronized & | setValue (const volatile X &value) |
| Sets value. | |
| const volatile X & | getValue () const volatile |
| Returns the current value. | |
| Synchronized & | operator= (const X &value) |
| Assignment operator. | |
| operator X () const volatile | |
| Conversion operator. | |
| X | operator++ () |
| Prefixed increment operator (ex: ++x). | |
| X | operator++ (int) |
| Postfixed increment operator (ex: x++). | |
| X | operator-- () |
| Prefixed decrement operator (ex: --x). | |
| X | operator-- (int) |
| Postfixed decrement operator (ex: x--). | |
Private Member Functions | |
| Synchronized () | |
| Default constructor made private to ensure that it will be never called. | |
| Synchronized (const Synchronized &source) | |
| Copy constructor made private to ensure that it will be never called. | |
| Synchronized & | operator= (const Synchronized &source) |
| Assignment operator made private to ensure that it will be never called. | |
Private Attributes | |
| volatile X | _value |
| The synchronized resource. | |
| Mutex | _mutex |
| The protecting mutex. | |
Any write operation first obtains a lock, then modifies the value, and unlocks the mutex, thus synchronizing the access to the value.
Definition at line 60 of file CeylanSynchronized.h.
| Ceylan::System::Synchronized< X >::Synchronized | ( | X | value | ) | [inline] |
Value assigned constructor.
Definition at line 74 of file CeylanSynchronized.h.
| Ceylan::System::Synchronized< X >::Synchronized | ( | ) | [private] |
Default constructor made private to ensure that it will be never called.
| Ceylan::System::Synchronized< X >::Synchronized | ( | const Synchronized< X > & | source | ) | [private] |
Copy constructor made private to ensure that it will be never called.
Calls such as: Synchronized<int> number = 0 ; should be rewritten in: Synchronized<int> number( 0 ) ; otherwise a copy constructor would be needed.
| const volatile X& Ceylan::System::Synchronized< X >::getValue | ( | ) | const volatile [inline] |
| Ceylan::System::Synchronized< X >::operator X | ( | ) | const volatile [inline] |
Conversion operator.
Definition at line 131 of file CeylanSynchronized.h.
References Ceylan::System::Synchronized< X >::_value.
| X Ceylan::System::Synchronized< X >::operator++ | ( | int | ) | [inline] |
| X Ceylan::System::Synchronized< X >::operator++ | ( | ) | [inline] |
Prefixed increment operator (ex: ++x).
Definition at line 141 of file CeylanSynchronized.h.
Referenced by Ceylan::System::Synchronized< bool >::operator++(), and Ceylan::System::Synchronized< ThreadCount >::operator++().
| X Ceylan::System::Synchronized< X >::operator-- | ( | int | ) | [inline] |
| X Ceylan::System::Synchronized< X >::operator-- | ( | ) | [inline] |
Prefixed decrement operator (ex: --x).
Definition at line 165 of file CeylanSynchronized.h.
Referenced by Ceylan::System::Synchronized< bool >::operator--(), and Ceylan::System::Synchronized< ThreadCount >::operator--().
| Synchronized& Ceylan::System::Synchronized< X >::operator= | ( | const Synchronized< X > & | source | ) | [private] |
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
| Synchronized& Ceylan::System::Synchronized< X >::operator= | ( | const X & | value | ) | [inline] |
| Synchronized& Ceylan::System::Synchronized< X >::setValue | ( | const volatile X & | value | ) | [inline] |
Sets value.
Definition at line 92 of file CeylanSynchronized.h.
Referenced by Ceylan::System::Synchronized< bool >::operator=(), and Ceylan::System::Synchronized< ThreadCount >::operator=().
Mutex Ceylan::System::Synchronized< X >::_mutex [private] |
The protecting mutex.
Definition at line 195 of file CeylanSynchronized.h.
Referenced by Ceylan::System::Synchronized< bool >::operator++(), Ceylan::System::Synchronized< ThreadCount >::operator++(), Ceylan::System::Synchronized< bool >::operator--(), Ceylan::System::Synchronized< ThreadCount >::operator--(), Ceylan::System::Synchronized< bool >::setValue(), and Ceylan::System::Synchronized< ThreadCount >::setValue().
volatile X Ceylan::System::Synchronized< X >::_value [private] |
The synchronized resource.
Definition at line 191 of file CeylanSynchronized.h.
Referenced by Ceylan::System::Synchronized< bool >::getValue(), Ceylan::System::Synchronized< ThreadCount >::getValue(), Ceylan::System::Synchronized< bool >::operator bool(), Ceylan::System::Synchronized< X >::operator X(), Ceylan::System::Synchronized< bool >::operator++(), Ceylan::System::Synchronized< ThreadCount >::operator++(), Ceylan::System::Synchronized< bool >::operator--(), Ceylan::System::Synchronized< ThreadCount >::operator--(), Ceylan::System::Synchronized< bool >::setValue(), and Ceylan::System::Synchronized< ThreadCount >::setValue().
1.5.8