Open Lighting Architecture
Latest Git
|
A thread object that can be subclassed.
Classes | |
struct | Options |
Thread options. More... | |
Public Member Functions | |
Thread (const Options &options=Options()) | |
Create a new thread with the specified thread options. More... | |
virtual | ~Thread () |
Destructor. | |
virtual bool | Start () |
Start the thread and wait for the thread to be running. More... | |
virtual bool | FastStart () |
Start the thread and return immediately. More... | |
virtual bool | Join (void *ptr=NULL) |
Join this thread. More... | |
bool | IsRunning () |
Check if the thread is running. More... | |
ThreadId | Id () const |
Return the thread id. More... | |
std::string | Name () const |
Return the thread name. More... | |
Static Public Member Functions | |
static ThreadId | Self () |
Returns the current thread's id. More... | |
Protected Member Functions | |
virtual void * | Run ()=0 |
The entry point for the new thread. More... | |
Create a new thread with the specified thread options.
options | the thread's options |
|
virtual |
Start the thread and return immediately.
Don't use this unless you know what you're doing, since it introduces a race condition with Join().
|
inline |
Return the thread id.
bool ola::thread::Thread::IsRunning | ( | ) |
Check if the thread is running.
This is best-effort only, since the thread may stop after IsRunning() returns.
|
virtual |
Join this thread.
[out] | ptr | The value returned from the thread. |
Reimplemented in ola::FilePreferenceSaverThread, and ola::plugin::usbpro::WidgetDetectorThread.
|
inline |
Return the thread name.
This may differ from the name assigned with pthread_setname, since the latter has a limit of 16 characters.
|
protectedpure virtual |
The entry point for the new thread.
Sub classes must implement this.
Implemented in ola::FilePreferenceSaverThread, ola::plugin::spi::SoftwareBackend, ola::http::HTTPServer, ola::plugin::gpio::GPIODriver, ola::plugin::spi::HardwareBackend, ola::plugin::usbpro::WidgetDetectorThread, ola::usb::LibUsbThread, ola::plugin::usbdmx::ThreadedUsbReceiver, ola::plugin::usbdmx::ThreadedUsbSender, ola::thread::PeriodicThread, OlaThread, ola::thread::ConsumerThread, ola::thread::SignalThread, ola::thread::CallbackThread, ola::plugin::spidmx::SPIDMXThread, ola::plugin::ftdidmx::FtdiDmxThread, ola::plugin::opendmx::OpenDmxThread, ola::plugin::karate::KarateThread, and ola::plugin::uartdmx::UartDmxThread.
|
inlinestatic |
Returns the current thread's id.
|
virtual |
Start the thread and wait for the thread to be running.
This will block until the thread is running. Use FastStart() if you don't want to block.
Reimplemented in ola::plugin::usbdmx::ThreadedUsbReceiver, ola::plugin::usbdmx::ThreadedUsbSender, and OlaThread.