SoDaRadio-5.0.3-master:8901fb5
|
The Thread baseclass for all SoDa thread objects. More...
#include <SoDaBase.hxx>
Public Member Functions | |
SoDaThread (const std::string &oname) | |
void | start () |
Execute the threads run loop. More... | |
void | join () |
more properly "Wait for this thread to exit its run loop". More... | |
bool | waitForJoin (unsigned int m) |
wait for the thread to stop running, or the specified time to pass. More... | |
virtual void | run ()=0 |
Each thread object must define its "run" loop. More... | |
void | execCommand (Command *cmd) |
Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions. More... | |
virtual void | execGetCommand (Command *cmd) |
optional method to handle "GET" commands – commands that request a response More... | |
virtual void | execSetCommand (Command *cmd) |
optional method to handle "SET" commands – commands that set internal state in the object. More... | |
virtual void | execRepCommand (Command *cmd) |
optional method that reports status or the result of some action. More... | |
Public Member Functions inherited from SoDa::SoDaBase | |
SoDaBase (const std::string &oname) | |
The constructor – pass a name for the object. More... | |
std::string & | getObjName () |
get the name of this object More... | |
SoDaBase * | findSoDaObject (const std::string &oname) |
find a SoDa Object by name. More... | |
double | getTime () |
Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS). More... | |
Public Member Functions inherited from SoDa::Debug | |
Debug (std::string _unit_name=std::string("UNKNOWN")) | |
Debug (const char *_unit_name_cstr) | |
Debug (unsigned int _debug_level, std::string _unit_name=std::string("UNKNOWN")) | |
Debug (unsigned int _debug_level, const char *_unit_name_cstr) | |
void | debugMsg (const std::string &msg, unsigned int threshold=1) |
void | debugMsg (const boost::format &fmt, unsigned int threshold=1) |
void | debugMsg (const char *msg, unsigned int threshold=1) |
void | setDebugLevel (unsigned int v) |
unsigned int | getDebugLevel () |
Private Member Functions | |
void | outerRun () |
the run method that is called by the boost thread handler. More... | |
void | hookSigSeg () |
Static Private Member Functions | |
static void | sigsegHandler (int sig) |
Private Attributes | |
boost::thread * | th |
Additional Inherited Members | |
Static Public Member Functions inherited from SoDa::Debug | |
static void | setDefaultLevel (unsigned int v) |
static unsigned int | getDefaultLevel () |
static void | setGlobalLevel (unsigned int v) |
static unsigned int | getGlobalLevel () |
Static Public Attributes inherited from SoDa::Debug | |
static boost::mutex | debug_msg_mutex |
Protected Member Functions inherited from SoDa::Debug | |
std::string | curDateTime () |
Protected Attributes inherited from SoDa::Debug | |
std::string | unit_name |
the name of the unit reporting status More... | |
unsigned int | debug_level |
the debug level (threshold) for messages More... | |
Static Protected Attributes inherited from SoDa::Debug | |
static unsigned int | default_debug_level = 0 |
static unsigned int | global_debug_level = 0 |
The Thread baseclass for all SoDa thread objects.
The SoDaThread baseclass simplifies interaction with threads. Since SoDa thread objects aren't created and destroyed very often, we don't need many bells and whistles here. Just the ability to start a thread a join a thread.
All threads, however, must declare a "run" function, and handlers for three types of SoDa::Command objects (GET, SET, and REPort)
Definition at line 284 of file SoDaBase.hxx.
|
inline |
Definition at line 286 of file SoDaBase.hxx.
|
inline |
Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions.
This sequence appears in so many of the instances of SoDaThread that it was factored out.
cmd | the command message to be handled |
Definition at line 335 of file SoDaBase.hxx.
References SoDa::Command::cmd, SoDa::Command::GET, SoDa::Command::REP, and SoDa::Command::SET.
Referenced by SoDa::UI::run(), SoDa::GPSmon::run(), SoDa::CWTX::run(), SoDa::USRPTX::run(), SoDa::BaseBandTX::run(), and SoDa::BaseBandRX::run().
|
inlinevirtual |
optional method to handle "GET" commands – commands that request a response
Reimplemented in SoDa::USRPCtrl, SoDa::BaseBandRX, SoDa::UI, SoDa::USRPTX, SoDa::BaseBandTX, SoDa::USRPRX, SoDa::CWTX, and SoDa::GPSmon.
Definition at line 355 of file SoDaBase.hxx.
|
inlinevirtual |
optional method that reports status or the result of some action.
Reimplemented in SoDa::USRPCtrl, SoDa::BaseBandRX, SoDa::USRPTX, SoDa::UI, SoDa::BaseBandTX, SoDa::CWTX, SoDa::USRPRX, and SoDa::GPSmon.
Definition at line 365 of file SoDaBase.hxx.
|
inlinevirtual |
optional method to handle "SET" commands – commands that set internal state in the object.
Reimplemented in SoDa::USRPCtrl, SoDa::BaseBandRX, SoDa::USRPTX, SoDa::UI, SoDa::BaseBandTX, SoDa::CWTX, SoDa::USRPRX, and SoDa::GPSmon.
Definition at line 360 of file SoDaBase.hxx.
|
inlineprivate |
Definition at line 416 of file SoDaBase.hxx.
References sigsegHandler().
|
inline |
more properly "Wait for this thread to exit its run loop".
returns after the thread has received a STOP message.
Definition at line 301 of file SoDaBase.hxx.
Referenced by doWork().
|
inlineprivate |
the run method that is called by the boost thread handler.
This method wraps the thread objects run loop in an exception handler so that we can do something useful with it.
Definition at line 376 of file SoDaBase.hxx.
References SoDa::SoDaException::toString().
Referenced by start().
|
pure virtual |
Each thread object must define its "run" loop.
This loop exits only when the thread has received a STOP command on one of its command mailboxes.
Implemented in SoDaTest::MultiMBox_Test_Thread, SoDa::BaseBandRX, SoDa::USRPCtrl, SoDa::BaseBandTX, SoDa::USRPTX, SoDa::USRPRX, SoDa::CWTX, SoDa::TestServer, SoDa::GPSmon, SoDa::UI, and SoDaTest::ThN.
|
inlinestaticprivate |
Definition at line 399 of file SoDaBase.hxx.
Referenced by hookSigSeg().
|
inline |
|
inline |
wait for the thread to stop running, or the specified time to pass.
m | timeout in milliseconds |
Definition at line 313 of file SoDaBase.hxx.
Referenced by doWork().
|
private |
Definition at line 368 of file SoDaBase.hxx.