|  | Kea 3.0.0
    | 
Base class for tests requiring threads. More...
#include <threaded_test.h>
| Protected Member Functions | |
| ThreadedTest () | |
| Constructor. | |
| void | doSignal (bool &flag) | 
| Sets selected flag to true and signals condition variable. | |
| void | doWait (bool &flag) | 
| Wait for a selected flag to be set. | |
| bool | isStopping () | 
| Checks if the thread is stopping. | |
| void | signalReady () | 
| Signal that thread is ready. | |
| void | signalStopped () | 
| Signal that thread is stopped. | |
| void | signalStopping () | 
| Signal that thread is stopping. | |
| void | waitReady () | 
| Wait for the thread to be ready. | |
| void | waitStopped () | 
| Wait for the thread to stop. | |
| void | waitStopping () | 
| Wait for the thread to be stopping. | |
| Protected Attributes | |
| std::condition_variable | condvar_ | 
| Conditional variable for thread waits. | |
| std::mutex | mutex_ | 
| Mutex used to synchronize threads. | |
| bool | ready_ | 
| Flag indicating that the thread is ready. | |
| bool | stopped_ | 
| Flag indicating that the thread is stopped. | |
| bool | stopping_ | 
| Flag indicating that the thread is stopping. | |
| boost::shared_ptr< std::thread > | thread_ | 
| Pointer to server thread. | |
Base class for tests requiring threads.
This class contains 3 flags to signal when the thread has started, is stopping and when it is stopped. The flags are accessed in thread safe manner.
Definition at line 24 of file threaded_test.h.
| 
 | protected | 
| 
 | protected | 
Sets selected flag to true and signals condition variable.
| flag | Reference to flag which should be set to true. | 
Definition at line 20 of file threaded_test.cc.
References condvar_, and mutex_.
Referenced by signalReady(), signalStopped(), and signalStopping().
| 
 | protected | 
Wait for a selected flag to be set.
| flag | Reference to a flag on which the thread is waiting. | 
Definition at line 44 of file threaded_test.cc.
References condvar_, and mutex_.
Referenced by waitReady(), waitStopped(), and waitStopping().
| 
 | protected | 
Checks if the thread is stopping.
Definition at line 67 of file threaded_test.cc.
| 
 | protected | 
Signal that thread is ready.
Definition at line 29 of file threaded_test.cc.
References doSignal(), and ready_.
| 
 | protected | 
Signal that thread is stopped.
Definition at line 39 of file threaded_test.cc.
References doSignal(), and stopped_.
| 
 | protected | 
Signal that thread is stopping.
Definition at line 34 of file threaded_test.cc.
References doSignal(), and stopping_.
| 
 | protected | 
Wait for the thread to be ready.
Definition at line 52 of file threaded_test.cc.
References doWait(), and ready_.
| 
 | protected | 
Wait for the thread to stop.
Definition at line 62 of file threaded_test.cc.
References doWait(), and stopped_.
| 
 | protected | 
Wait for the thread to be stopping.
Definition at line 57 of file threaded_test.cc.
References doWait(), and stopping_.
| 
 | protected | 
Conditional variable for thread waits.
Definition at line 72 of file threaded_test.h.
Referenced by ThreadedTest(), doSignal(), and doWait().
| 
 | protected | 
Mutex used to synchronize threads.
Definition at line 69 of file threaded_test.h.
Referenced by doSignal(), doWait(), and isStopping().
| 
 | protected | 
Flag indicating that the thread is ready.
Definition at line 75 of file threaded_test.h.
Referenced by ThreadedTest(), signalReady(), and waitReady().
| 
 | protected | 
Flag indicating that the thread is stopped.
Definition at line 81 of file threaded_test.h.
Referenced by ThreadedTest(), signalStopped(), and waitStopped().
| 
 | protected | 
Flag indicating that the thread is stopping.
Definition at line 78 of file threaded_test.h.
Referenced by ThreadedTest(), isStopping(), signalStopping(), and waitStopping().
| 
 | protected | 
Pointer to server thread.
Definition at line 66 of file threaded_test.h.
Referenced by ThreadedTest().