11 #ifndef INCLUDED_LIBCYBERRADIO_THREAD_H 12 #define INCLUDED_LIBCYBERRADIO_THREAD_H 14 #include <boost/thread.hpp> 15 #include <boost/chrono.hpp> 57 Thread(
const std::string& name =
"",
58 const std::string& cls =
"");
85 virtual void run() = 0;
98 virtual void sleep(
double secs);
108 virtual void setName(
const std::string& name);
113 virtual void setClass(
const std::string& cls);
119 virtual boost::thread::id
getId()
const;
142 virtual void onException(
const std::exception& ex);
145 virtual void thisThreadRun();
148 boost::thread _thisThread;
virtual std::string getIdString() const
Gets the identifier string for this thread.
Thread(const std::string &name="", const std::string &cls="")
Creates a Thread object.
virtual bool isRunning() const
Determines if the thread is running or not.
virtual void run()=0
Executes the main processing loop for the thread.
virtual boost::thread::id getId() const
Gets the identifier of the underlying Boost thread.
virtual void interrupt()
Interrupts (stops) the thread.
virtual void start()
Starts thread processing.
virtual ~Thread()
Destroys a Thread object.
virtual void setClass(const std::string &cls)
Sets the class identifer string for the thread.
virtual Thread & operator=(const Thread &src)
Creates a Thread object by assignment from another Thread object.
Defines functionality for LibCyberRadio applications.
virtual void setName(const std::string &name)
Sets the name of the thread.
virtual void onException(const std::exception &ex)
Executes code that must run when an unhandled exception occurs within the thread. ...
Base class for a thread object, based on Boost Threads.
virtual void sleep(double secs)
Pauses thread execution for a given time, checking for user interrupts during that time...
virtual void onInterrupt()
Executes code that must run when the thread is interrupted.