#include <source/ariba/utility/system/SystemQueue.h>
Classes | |
class | QueueThread |
class | QueueThreadDelay |
class | QueueThreadDirect |
Public Member Functions | |
void | scheduleEvent (const SystemEvent &event, uint32_t delay=0) |
void | run () |
void | cancel () |
void | dropAll (const SystemEventListener *mlistener) |
bool | isEmpty () |
bool | isRunning () |
Static Public Member Functions | |
static SystemQueue & | instance () |
Protected Member Functions | |
void | enterMethod () |
void | leaveMethod () |
SystemQueue () | |
~SystemQueue () | |
Private Types | |
typedef vector< SystemEvent > | EventQueue |
Private Member Functions | |
use_logging_h (SystemQueue) | |
Private Attributes | |
QueueThreadDirect | directScheduler |
QueueThreadDelay | delayScheduler |
volatile bool | systemQueueRunning |
Friends | |
class | EnterMethod |
This class implements a simple system event queue to allow a simulation of cooperative multitasking. It also allows events to be scheduled from other tasks. This allows dispatching asynchronous tasks.
Definition at line 78 of file SystemQueue.h.
typedef vector<SystemEvent> ariba::utility::SystemQueue::EventQueue [private] |
Definition at line 175 of file SystemQueue.h.
ariba::utility::SystemQueue::SystemQueue | ( | ) | [protected] |
Constructs a system queue.
Definition at line 45 of file SystemQueue.cpp.
ariba::utility::SystemQueue::~SystemQueue | ( | ) | [protected] |
Destroys the system queue. Beware that all events are canceled
Definition at line 52 of file SystemQueue.cpp.
void ariba::utility::SystemQueue::cancel | ( | ) |
Cancels the system queue and ends the processing after the currently processed event is processed.
This method is thread-safe.
Definition at line 89 of file SystemQueue.cpp.
References ariba::utility::SystemQueue::QueueThread::cancel(), delayScheduler, directScheduler, and systemQueueRunning.
Referenced by ariba::utility::StartupWrapper::stopSystem().
void ariba::utility::SystemQueue::dropAll | ( | const SystemEventListener * | mlistener | ) |
Drop all queued events for that listener
Definition at line 97 of file SystemQueue.cpp.
References delayScheduler, directScheduler, and ariba::utility::SystemQueue::QueueThread::dropAll().
Referenced by ariba::utility::Timer::stop().
void ariba::utility::SystemQueue::enterMethod | ( | ) | [protected] |
Aqcuire the mutex
Definition at line 120 of file SystemQueue.cpp.
References directScheduler, and ariba::utility::SystemQueue::QueueThread::enter().
Referenced by ariba::utility::EnterMethod::enter().
static SystemQueue& ariba::utility::SystemQueue::instance | ( | ) | [inline, static] |
Get the SystemQueue singleton instance.
Definition at line 89 of file SystemQueue.h.
Referenced by ariba::utility::BlockingMethod::dispatch(), ariba::utility::EnterMethod::enter(), ariba::utility::Timer::handleSystemEvent(), ariba::utility::EnterMethod::leave(), ariba::communication::NetworkChangeDetection::monitoringThreadFunc(), ariba::communication::BaseCommunication::receive_message(), ariba::utility::Timer::start(), ariba::utility::StartupWrapper::startSystem(), ariba::utility::StartupWrapper::startup(), ariba::utility::Timer::stop(), ariba::utility::StartupWrapper::stopSystem(), and ariba::utility::Timer::threadFunc().
bool ariba::utility::SystemQueue::isEmpty | ( | ) |
Check wheter this queue has items or not.
Definition at line 104 of file SystemQueue.cpp.
References delayScheduler, directScheduler, and ariba::utility::SystemQueue::QueueThread::isEmpty().
bool ariba::utility::SystemQueue::isRunning | ( | ) |
Is the system queue already started and running?
Definition at line 112 of file SystemQueue.cpp.
References systemQueueRunning.
void ariba::utility::SystemQueue::leaveMethod | ( | ) | [protected] |
Leave the mutex
Definition at line 125 of file SystemQueue.cpp.
References directScheduler, and ariba::utility::SystemQueue::QueueThread::leave().
Referenced by ariba::utility::EnterMethod::leave().
void ariba::utility::SystemQueue::run | ( | ) |
Starts the processing and waiting for events. Use cancel()
to end system queue processing and isEmpty()
to check wheter the queue is empty.
Definition at line 81 of file SystemQueue.cpp.
References delayScheduler, directScheduler, ariba::utility::SystemQueue::QueueThread::run(), and systemQueueRunning.
Referenced by ariba::utility::StartupWrapper::startSystem().
void ariba::utility::SystemQueue::scheduleEvent | ( | const SystemEvent & | event, | |
uint32_t | delay = 0 | |||
) |
This methods schedules a given event.
The | event to be scheduled | |
The | delay in milli-seconds |
Definition at line 55 of file SystemQueue.cpp.
References delayScheduler, directScheduler, and ariba::utility::SystemQueue::QueueThread::insert().
Referenced by ariba::utility::BlockingMethod::dispatch(), ariba::utility::Timer::handleSystemEvent(), ariba::communication::NetworkChangeDetection::monitoringThreadFunc(), ariba::communication::BaseCommunication::receive_message(), ariba::utility::Timer::start(), ariba::utility::StartupWrapper::startup(), and ariba::utility::Timer::threadFunc().
ariba::utility::SystemQueue::use_logging_h | ( | SystemQueue | ) | [private] |
friend class EnterMethod [friend] |
Definition at line 84 of file SystemQueue.h.
Definition at line 234 of file SystemQueue.h.
Referenced by cancel(), dropAll(), isEmpty(), run(), and scheduleEvent().
Definition at line 233 of file SystemQueue.h.
Referenced by cancel(), dropAll(), enterMethod(), isEmpty(), leaveMethod(), run(), and scheduleEvent().
volatile bool ariba::utility::SystemQueue::systemQueueRunning [private] |
Definition at line 235 of file SystemQueue.h.
Referenced by cancel(), isRunning(), and run().