MADARA
3.4.1
|
Abstract base class for implementing threads. More...
#include <BaseThread.h>
Public Member Functions | |
virtual | ~BaseThread () |
Destructor. More... | |
virtual void | cleanup (void) |
Cleans up any thread residue (usually instances created in init). More... | |
virtual void | init (knowledge::KnowledgeBase &) |
Initializes thread with a MADARA context. More... | |
virtual void | run (void)=0 |
Executes the main thread logic. More... | |
Protected Member Functions | |
virtual void | init_control_vars (knowledge::KnowledgeBase &control) |
Initializes the thread implementation's control plane variables. More... | |
Protected Attributes | |
std::string | name |
The unique name of your thread. More... | |
madara::knowledge::containers::Integer | paused |
thread safe paused flag that may be set by the Threader More... | |
madara::knowledge::containers::Integer | terminated |
thread safe terminated flag that may be set by the Threader base More... | |
Friends | |
class | Threader |
class | WorkerThread |
Worker threads are MADARA thread entities that manage user-defined threads. More... | |
Abstract base class for implementing threads.
Definition at line 38 of file BaseThread.h.
|
inlinevirtual |
Destructor.
Definition at line 44 of file BaseThread.h.
|
inlinevirtual |
Cleans up any thread residue (usually instances created in init).
It's important to note that the only things that would need to be cleaned up are generally ports opened, memory initialized with new/malloc, etc. Anything MADARA related is generally cleaned up for you.
Reimplemented in madara::transport::UdpTransportReadThread, madara::transport::MulticastTransportReadThread, madara::transport::ZMQTransportReadThread, madara::transport::SpliceReadThread, and madara::threads::JavaThread.
Definition at line 71 of file BaseThread.h.
|
inlinevirtual |
Initializes thread with a MADARA context.
Reimplemented in madara::transport::UdpTransportReadThread, madara::transport::ZMQTransportReadThread, madara::transport::SpliceReadThread, and madara::threads::JavaThread.
Definition at line 56 of file BaseThread.h.
|
inlineprotectedvirtual |
Initializes the thread implementation's control plane variables.
control | the control plane between Threader and threads |
Reimplemented in madara::threads::JavaThread.
Definition at line 78 of file BaseThread.h.
|
pure virtual |
Executes the main thread logic.
In a BaseThread, the execute is called once. Afterwards, cleanup is called.
Implemented in madara::transport::UdpTransportReadThread, madara::transport::ZMQTransportReadThread, madara::transport::SpliceReadThread, and madara::threads::JavaThread.
|
friend |
Definition at line 51 of file BaseThread.h.
|
friend |
Worker threads are MADARA thread entities that manage user-defined threads.
Definition at line 50 of file BaseThread.h.
|
protected |
The unique name of your thread.
Definition at line 90 of file BaseThread.h.
|
protected |
thread safe paused flag that may be set by the Threader
Definition at line 101 of file BaseThread.h.
|
protected |
thread safe terminated flag that may be set by the Threader base
Definition at line 96 of file BaseThread.h.