#include <thread.h>

It is implemented with POSIX threads. Code that uses this class should link with libpthread and librt (for nanosleep).
Definition at line 13 of file thread.h.
Public Member Functions | |
| Thread () | |
| virtual | ~Thread () |
| void | start (Runnable *runnable=0) |
| void | stop () |
| bool | shouldStop () const |
| bool | isRunning () const |
| void | join () |
| pthread_t | getID () |
| virtual void | run () |
Static Public Member Functions | |
| static unsigned int | count () |
| static Thread * | getCurrent () |
| static void | sleep (unsigned int milli) |
| static void | yield () |
| CVD::Thread::Thread | ( | ) |
Construct a thread. If runnable != 0, use that runnable, else use our own "run" method.
| virtual CVD::Thread::~Thread | ( | ) | [virtual] |
This does not destroy the object until the thread has been terminated.
| void CVD::Thread::start | ( | Runnable * | runnable = 0 |
) |
Start execution of "run" method in separate thread.
Referenced by CVD::ReadAheadVideoBuffer< T >::ReadAheadVideoBuffer().
| void CVD::Thread::stop | ( | ) |
Tell the thread to stop.
This doesn't make the thread actually stop, it just causes shouldStop() to return true.
Referenced by CVD::ReadAheadVideoBuffer< T >::~ReadAheadVideoBuffer().
| bool CVD::Thread::shouldStop | ( | ) | const |
Returns true if the stop() method been called, false otherwise.
Referenced by CVD::ReadAheadVideoBuffer< T >::run().
| bool CVD::Thread::isRunning | ( | ) | const |
Returns true if the thread is still running.
| void CVD::Thread::join | ( | ) |
This blocks until the thread has actually terminated.
If the thread is infinite looping, this will block forever!
Referenced by CVD::ReadAheadVideoBuffer< T >::~ReadAheadVideoBuffer().
| pthread_t CVD::Thread::getID | ( | ) |
Get the ID of this thread.
| virtual void CVD::Thread::run | ( | ) | [inline, virtual] |
| static unsigned int CVD::Thread::count | ( | ) | [static] |
Returns how many threads are actually running, not including the main thread.
| static Thread* CVD::Thread::getCurrent | ( | ) | [static] |
Returns a pointer to the currently running thread.
| static void CVD::Thread::sleep | ( | unsigned int | milli | ) | [static] |
Tell the current thread to sleep for milli milliseconds.
| static void CVD::Thread::yield | ( | ) | [static] |
Tell the current thread to yield the processor.
1.5.3