MADARA
3.1.8
|
Abstract base class for implementing RCW threads. More...
#include <RCWThread.h>
Public Member Functions | |
virtual | ~RCWThread () |
Destructor. More... | |
virtual void | compute (const knowledge::rcw::Transaction &)=0 |
Executes the compute porition of a read-compute-write loop. More... | |
virtual void | finalize (knowledge::rcw::Transaction &) |
Cleans up any thread residue (usually instances created in setup). More... | |
virtual void | setup (knowledge::rcw::Transaction &) |
Setup the thread for later read-compute-write loops. More... | |
Protected Member Functions | |
virtual void | init_control_vars (knowledge::KnowledgeBase &control) |
Initializes the Java 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... | |
Private Member Functions | |
virtual void | cleanup (void) overridefinal |
Cleans up any thread residue (usually instances created in init). More... | |
virtual void | init (knowledge::KnowledgeBase &kb) overridefinal |
Initializes thread with a MADARA context. More... | |
virtual void | run (void) overridefinal |
Executes the main thread logic. More... | |
Private Attributes | |
std::unique_ptr< knowledge::rcw::Transaction > | tx_ |
Friends | |
class | Threader |
class | WorkerThread |
Worker threads are MADARA thread entities that manage user-defined threads. More... | |
Abstract base class for implementing RCW threads.
Users should override setup, compute, and finalize, but should not override the init, run, and cleanup functions from BaseThread
Definition at line 40 of file RCWThread.h.
|
inlinevirtual |
Destructor.
Definition at line 46 of file RCWThread.h.
|
finaloverrideprivatevirtual |
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 from madara::threads::BaseThread.
Definition at line 20 of file RCWThread.cpp.
|
pure virtual |
Executes the compute porition of a read-compute-write loop.
|
inlinevirtual |
Cleans up any thread residue (usually instances created in setup).
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.
Definition at line 76 of file RCWThread.h.
|
finaloverrideprivatevirtual |
Initializes thread with a MADARA context.
kb | the knowledge base to interact with |
Reimplemented from madara::threads::BaseThread.
Definition at line 7 of file RCWThread.cpp.
|
inlineprotectedvirtualinherited |
Initializes the Java thread implementation's control plane variables.
control | the control plane between Threader and threads |
Reimplemented in madara::threads::JavaThread.
Definition at line 86 of file BaseThread.h.
|
finaloverrideprivatevirtual |
Executes the main thread logic.
In a BaseThread, the execute is called once. Afterwards, cleanup is called.
Implements madara::threads::BaseThread.
Definition at line 13 of file RCWThread.cpp.
|
inlinevirtual |
Setup the thread for later read-compute-write loops.
Definition at line 60 of file RCWThread.h.
|
friend |
Definition at line 55 of file RCWThread.h.
|
friend |
Worker threads are MADARA thread entities that manage user-defined threads.
Definition at line 54 of file RCWThread.h.
|
protectedinherited |
The unique name of your thread.
Definition at line 96 of file BaseThread.h.
|
protectedinherited |
thread safe paused flag that may be set by the Threader
Definition at line 107 of file BaseThread.h.
|
protectedinherited |
thread safe terminated flag that may be set by the Threader base
Definition at line 102 of file BaseThread.h.
|
private |
Definition at line 102 of file RCWThread.h.