Open Lighting Architecture
|
Signals and threads don't play nicely together. Consider the following:
The recommended way to deal with this is to run a separate thread, whose sole purpose is to wait for signals. See section 12.8 of APUE.
To avoid this we do the following:
Public Types | |
typedef ola::Callback0< void > | SignalHandler |
Public Member Functions | |
bool | InstallSignalHandler (int signal, SignalHandler *handler) |
Public Member Functions inherited from ola::thread::Thread | |
virtual bool | Start () |
virtual bool | FastStart () |
virtual bool | Join (void *ptr=NULL) |
bool | IsRunning () |
ThreadId | Id () const |
void * | _InternalRun () |
Protected Member Functions | |
void * | Run () |
Additional Inherited Members | |
Static Public Member Functions inherited from ola::thread::Thread | |
static ThreadId | Self () |
bool ola::thread::SignalThread::InstallSignalHandler | ( | int | signal, |
SignalHandler * | handler | ||
) |
Install a signal handler for the given signal. This can't be called once the thread has stared.
|
protectedvirtual |
Entry point into the thread.
Implements ola::thread::Thread.