MADARA
3.4.1
|
A thread that executes BaseThread logic. More...
#include <WorkerThread.h>
Public Member Functions | |
WorkerThread () | |
Default constructor. More... | |
WorkerThread (const std::string &name, BaseThread *thread, knowledge::KnowledgeBase *control, knowledge::KnowledgeBase *data, double hertz=-1.0) | |
Constructor deprecated: use version that takes control and data by value. More... | |
WorkerThread (const std::string &name, BaseThread *thread, knowledge::KnowledgeBase control, knowledge::KnowledgeBase data, double hertz=-1.0) | |
Constructor. More... | |
WorkerThread (WorkerThread &&other)=default | |
~WorkerThread () noexcept | |
Destructor. More... | |
Protected Member Functions | |
void | change_frequency (double hertz, utility::TimeValue ¤t, utility::Duration &frequency, utility::TimeValue &next_epoch, bool &one_shot, bool &blaster) |
Changes the frequency given a hertz rate. More... | |
void | run (void) |
Starts the thread, with entry point svc() More... | |
int | svc (void) |
Task loop. More... | |
Protected Attributes | |
knowledge::KnowledgeBase | control_ |
the control plane to the knowledge base More... | |
knowledge::KnowledgeBase | data_ |
the data plane (the knowledge base) More... | |
knowledge::containers::Integer | debug_ |
flag for whether or not to save debug information in control More... | |
knowledge::containers::Integer | end_time_ |
timestamp of the last svc end More... | |
knowledge::containers::Integer | executions_ |
thread safe start flag that will be sent to the knowledge base on launch of the thread More... | |
knowledge::containers::Integer | finished_ |
thread safe finished flag that will be sent to the knowledge base on completion of the thread More... | |
double | hertz_ = -1 |
hertz rate for worker thread executions More... | |
knowledge::containers::Integer | last_duration_ |
duration of last run More... | |
knowledge::containers::Integer | last_start_time_ |
timestamp of the last svc start More... | |
knowledge::containers::Integer | max_duration_ |
maximum duration of all runs More... | |
std::thread | me_ |
Assignment operator. More... | |
knowledge::containers::Integer | min_duration_ |
minimum duration of all runs More... | |
std::string | name_ |
the name of the contained thread More... | |
knowledge::containers::Double | new_hertz_ |
thread safe hertz reference More... | |
madara::knowledge::containers::Integer | paused_ |
thread safe paused flag that will be sent to the knowledge base to indicate thread activities should pause More... | |
madara::knowledge::containers::Integer | running_ |
thread safe paused flag that will be sent to the knowledge base to indicate thread activities should pause More... | |
knowledge::containers::Integer | start_time_ |
timestamp of the initial svc start More... | |
knowledge::containers::Integer | started_ |
thread safe start flag that will be sent to the knowledge base on launch of the thread More... | |
std::unique_ptr< BaseThread > | thread_ = nullptr |
the contained thread More... | |
Friends | |
class | Threader |
give access to our status flags to the Threader class More... | |
|
inline |
Default constructor.
Definition at line 41 of file WorkerThread.h.
|
inline |
Constructor deprecated: use version that takes control and data by value.
name | the name of the user thread |
thread | the user thread |
control | the knowledge base that provides a control plane between the data knowledge base and threads |
data | the knowledge base that provides user data access |
hertz | the hertz rate to run the thread |
Definition at line 54 of file WorkerThread.h.
madara::threads::WorkerThread::WorkerThread | ( | const std::string & | name, |
BaseThread * | thread, | ||
knowledge::KnowledgeBase | control, | ||
knowledge::KnowledgeBase | data, | ||
double | hertz = -1.0 |
||
) |
Constructor.
name | the name of the user thread |
thread | the user thread |
control | the knowledge base that provides a control plane between the data knowledge base and threads |
data | the knowledge base that provides user data access |
hertz | the hertz rate to run the thread |
Definition at line 22 of file WorkerThread.cpp.
|
default |
|
noexcept |
Destructor.
Definition at line 71 of file WorkerThread.cpp.
|
inlineprotected |
Changes the frequency given a hertz rate.
hertz | the new hertz rate |
current | current time |
frequency | an updated frequency value |
next_epoch | next time to trigger execution |
one_shot | if hertz rate is less than 0, true. Otherwise, false |
blaster | if hertz rate is 0, true. Otherwise, false. |
Definition at line 17 of file WorkerThread.inl.
|
protected |
Starts the thread, with entry point svc()
Definition at line 123 of file WorkerThread.cpp.
|
protected |
Task loop.
Definition at line 152 of file WorkerThread.cpp.
|
friend |
give access to our status flags to the Threader class
Definition at line 36 of file WorkerThread.h.
|
protected |
the control plane to the knowledge base
Definition at line 121 of file WorkerThread.h.
|
protected |
the data plane (the knowledge base)
Definition at line 124 of file WorkerThread.h.
|
protected |
flag for whether or not to save debug information in control
Definition at line 194 of file WorkerThread.h.
|
protected |
timestamp of the last svc end
Definition at line 174 of file WorkerThread.h.
|
protected |
thread safe start flag that will be sent to the knowledge base on launch of the thread
Definition at line 159 of file WorkerThread.h.
|
protected |
thread safe finished flag that will be sent to the knowledge base on completion of the thread
Definition at line 130 of file WorkerThread.h.
|
protected |
hertz rate for worker thread executions
Definition at line 199 of file WorkerThread.h.
|
protected |
duration of last run
Definition at line 179 of file WorkerThread.h.
|
protected |
timestamp of the last svc start
Definition at line 169 of file WorkerThread.h.
|
protected |
maximum duration of all runs
Definition at line 189 of file WorkerThread.h.
|
protected |
Assignment operator.
input | thread information to copy |
Definition at line 88 of file WorkerThread.h.
|
protected |
minimum duration of all runs
Definition at line 184 of file WorkerThread.h.
|
protected |
the name of the contained thread
Definition at line 115 of file WorkerThread.h.
|
protected |
thread safe hertz reference
Definition at line 153 of file WorkerThread.h.
|
protected |
thread safe paused flag that will be sent to the knowledge base to indicate thread activities should pause
Definition at line 136 of file WorkerThread.h.
|
protected |
thread safe paused flag that will be sent to the knowledge base to indicate thread activities should pause
Definition at line 142 of file WorkerThread.h.
|
protected |
timestamp of the initial svc start
Definition at line 164 of file WorkerThread.h.
|
protected |
thread safe start flag that will be sent to the knowledge base on launch of the thread
Definition at line 148 of file WorkerThread.h.
|
protected |
the contained thread
Definition at line 118 of file WorkerThread.h.