MADARA
3.1.8
|
This class executes expression events at specified times. More...
#include <TimedExecutor.h>
Public Member Functions | |
TimedExecutor () | |
Default constructor. More... | |
~TimedExecutor () | |
Destructor. More... | |
void | add (const TimedEvent &new_event) |
Adds a timed event to the queue. More... | |
void | add (const Event &new_event) |
Adds an event to the queue. More... | |
void | clear_queue (void) |
Clears the event queue. More... | |
void | enter_barrier (void) |
Enters the barrier. More... | |
bool | is_shutdown (void) |
Checks if the thread pool has been shutdown. More... | |
void | launch_threads (unsigned int threads) |
Launches threads. More... | |
knowledge::KnowledgeRecord::Integer | num_threads (void) |
Returns the number of threads. More... | |
ACE_Time_Value | remove (TimedEvent &cur_event) |
Removes a timed event from the queue. More... | |
void | shutdown (void) |
Informs threads of a shutdown and waits for threads to exit. More... | |
ACE_Time_Value | time_until_next (void) |
Returns the time. More... | |
Private Types | |
typedef std::priority_queue< TimedEvent, std::vector< TimedEvent > > | PriorityQueue |
guard for access and changes More... | |
Private Member Functions | |
void | lock (void) |
Locks the context. More... | |
void | unlock (void) |
Unlocks the event queue. More... | |
Private Attributes | |
KnowledgeBase | control_plane_ |
For barrier and other information. More... | |
PriorityQueue | events_ |
Event queue. More... | |
MADARA_LOCK_TYPE | mutex_ |
Mutex for local changes. More... | |
knowledge::KnowledgeRecord::Integer | num_threads_ |
Number of thread. More... | |
VariableReference | queue_size_ |
Reference to queue size in the control plane. More... | |
VariableReference | terminated_ |
Reference to terminated condition within control plane. More... | |
TimedEventThreadInfo * | thread_info_ |
Vector of thread info. More... | |
TimedEventThread ** | threads_ |
Timed Event Threads. More... | |
VariableReference | threads_ref_ |
Reference to the number of threads in the control plane. More... | |
This class executes expression events at specified times.
Definition at line 77 of file TimedExecutor.h.
|
private |
madara::knowledge::TimedExecutor::TimedExecutor | ( | ) |
Default constructor.
Definition at line 14 of file TimedExecutor.cpp.
madara::knowledge::TimedExecutor::~TimedExecutor | ( | ) |
Destructor.
Definition at line 23 of file TimedExecutor.cpp.
void madara::knowledge::TimedExecutor::add | ( | const TimedEvent & | new_event | ) |
Adds a timed event to the queue.
new_event | new event to add to the queue |
Definition at line 30 of file TimedExecutor.cpp.
void madara::knowledge::TimedExecutor::add | ( | const Event & | new_event | ) |
Adds an event to the queue.
new_event | new event to add to the queue. |
Definition at line 42 of file TimedExecutor.cpp.
void madara::knowledge::TimedExecutor::clear_queue | ( | void | ) |
Clears the event queue.
Note that this only clears the queue. If there are events currently being processed in timed event threads, they may be added to the queue once they are completed. Consequently, clear_queue is usually only completely effective if shutdown has been called previously.
Definition at line 261 of file TimedExecutor.cpp.
void madara::knowledge::TimedExecutor::enter_barrier | ( | void | ) |
Enters the barrier.
Definition at line 238 of file TimedExecutor.cpp.
bool madara::knowledge::TimedExecutor::is_shutdown | ( | void | ) |
Checks if the thread pool has been shutdown.
Definition at line 160 of file TimedExecutor.cpp.
void madara::knowledge::TimedExecutor::launch_threads | ( | unsigned int | threads | ) |
Launches threads.
threads | number of threads |
Definition at line 166 of file TimedExecutor.cpp.
|
private |
Locks the context.
Definition at line 205 of file TimedExecutor.cpp.
madara::knowledge::KnowledgeRecord::Integer madara::knowledge::TimedExecutor::num_threads | ( | void | ) |
Returns the number of threads.
Definition at line 274 of file TimedExecutor.cpp.
ACE_Time_Value madara::knowledge::TimedExecutor::remove | ( | TimedEvent & | cur_event | ) |
Removes a timed event from the queue.
cur_event | a placeholder for the current highest priority event |
Definition at line 64 of file TimedExecutor.cpp.
void madara::knowledge::TimedExecutor::shutdown | ( | void | ) |
Informs threads of a shutdown and waits for threads to exit.
Definition at line 131 of file TimedExecutor.cpp.
ACE_Time_Value madara::knowledge::TimedExecutor::time_until_next | ( | void | ) |
Returns the time.
Definition at line 192 of file TimedExecutor.cpp.
|
private |
Unlocks the event queue.
Definition at line 211 of file TimedExecutor.cpp.
|
private |
For barrier and other information.
Definition at line 200 of file TimedExecutor.h.
|
private |
Event queue.
Definition at line 180 of file TimedExecutor.h.
|
mutableprivate |
Mutex for local changes.
Definition at line 175 of file TimedExecutor.h.
|
private |
Number of thread.
Definition at line 195 of file TimedExecutor.h.
|
private |
Reference to queue size in the control plane.
Definition at line 210 of file TimedExecutor.h.
|
private |
Reference to terminated condition within control plane.
Definition at line 215 of file TimedExecutor.h.
|
private |
Vector of thread info.
Definition at line 185 of file TimedExecutor.h.
|
private |
Timed Event Threads.
Definition at line 190 of file TimedExecutor.h.
|
private |
Reference to the number of threads in the control plane.
Definition at line 205 of file TimedExecutor.h.