#include <pres_ent.h>
Inheritance diagram for OpalPresentityWithCommandThread:
Construction | |
~OpalPresentityWithCommandThread () | |
OpalPresentityWithCommandThread () | |
Construct the presentity class that uses a command thread. | |
Public Member Functions | |
Overrides from OpalPresentity | |
virtual bool | SendCommand (OpalPresentityCommand *cmd) |
new functions | |
void | StartThread (bool startQueue=true) |
void | StopThread () |
void | StartQueue (bool startQueue=true) |
Protected Types | |
typedef std::queue< OpalPresentityCommand * > | CommandQueue |
Protected Member Functions | |
void | ThreadMain () |
Protected Attributes | |
CommandQueue | m_commandQueue |
PMutex | m_commandQueueMutex |
PAtomicInteger | m_commandSequence |
PSyncPoint | m_commandQueueSync |
bool | m_threadRunning |
bool | m_queueRunning |
PThread * | m_thread |
typedef std::queue<OpalPresentityCommand *> OpalPresentityWithCommandThread::CommandQueue [protected] |
OpalPresentityWithCommandThread::OpalPresentityWithCommandThread | ( | ) | [protected] |
Construct the presentity class that uses a command thread.
OpalPresentityWithCommandThread::~OpalPresentityWithCommandThread | ( | ) |
Destory the presentity class that uses a command thread. Note this will block until the background thread has stopped.
virtual bool OpalPresentityWithCommandThread::SendCommand | ( | OpalPresentityCommand * | cmd | ) | [virtual] |
Lowlevel function to send a command to the presentity handler. All commands are asynchronous. They will usually initiate an action for which an indication (callback) will give a result.
The default implementation queues the command for the background thread to handle.
Returns true if the command was queued. Note that this does not mean the command succeeded, only that the underlying protocol is processing commands, that is the backgrund thread is running
cmd | Command to execute |
Reimplemented from OpalPresentity.
void OpalPresentityWithCommandThread::StartQueue | ( | bool | startQueue = true |
) |
Start/resume processing of queue commands
void OpalPresentityWithCommandThread::StartThread | ( | bool | startQueue = true |
) |
Start the background thread to handle commands. This is typically called from the concrete classes Open() function.
If the argument is true (the default) then the thread starts processing queue entries ASAP.
If the argument is false, the thread is still created and still runs, but it does not process queue entries. This allows for presenties that may need to allow commands to be paused, for example during initialisation
void OpalPresentityWithCommandThread::StopThread | ( | ) |
Stop the background thread to handle commands. This is typically called from the concrete classes Close() function. It is also called fro the destructor to be sure the thread has stopped before the object is destroyed.
void OpalPresentityWithCommandThread::ThreadMain | ( | ) | [protected] |
PMutex OpalPresentityWithCommandThread::m_commandQueueMutex [protected] |
PSyncPoint OpalPresentityWithCommandThread::m_commandQueueSync [protected] |
PAtomicInteger OpalPresentityWithCommandThread::m_commandSequence [protected] |
bool OpalPresentityWithCommandThread::m_queueRunning [protected] |
PThread* OpalPresentityWithCommandThread::m_thread [protected] |
bool OpalPresentityWithCommandThread::m_threadRunning [protected] |