CVD::Thread Class Reference
#include <thread.h>
List of all members.
Public Member Functions |
| pthread_t | getID () |
| | Get the ID of this thread.
|
| bool | isRunning () const |
| | Returns true if the thread is still running.
|
| void | join () |
| | This blocks until the thread has actually terminated.
|
| virtual void | run () |
| | Override this method to do whatever it is the thread should do.
|
| bool | shouldStop () const |
| | Returns true if the stop() method been called, false otherwise.
|
| void | start (Runnable *runnable=0) |
| | Start execution of "run" method in separate thread.
|
| void | stop () |
| | Tell the thread to stop.
|
| | Thread () |
| | Construct a thread. If runnable != 0, use that runnable, else use our own "run" method.
|
| virtual | ~Thread () |
| | This does not destroy the object until the thread has been terminated.
|
Static Public Member Functions |
| static unsigned int | count () |
| | Returns how many threads are actually running, not including the main thread.
|
| static Thread * | getCurrent () |
| | Returns a pointer to the currently running thread.
|
| static void | sleep (unsigned int milli) |
| | Tell the current thread to sleep for milli milliseconds.
|
| static void | yield () |
| | Tell the current thread to yield the processor.
|
Static Private Member Functions |
| static bool | init () |
| static void * | threadproc (void *param) |
Private Attributes |
| pthread_t | myID |
| Runnable * | myRunnable |
| bool | myRunningFlag |
| bool | myStopFlag |
Static Private Attributes |
| static unsigned int | ourCount |
| static bool | ourInitializedFlag |
| static pthread_key_t | ourKey |
Detailed Description
The Thread class encapsulates a thread of execution. 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.
Constructor & Destructor Documentation
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.
Member Function Documentation
| 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.
| pthread_t CVD::Thread::getID |
( |
|
) |
|
Get the ID of this thread.
| static bool CVD::Thread::init |
( |
|
) |
[static, private] |
| 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!
| virtual void CVD::Thread::run |
( |
|
) |
[inline, virtual] |
| bool CVD::Thread::shouldStop |
( |
|
) |
const |
Returns true if the stop() method been called, false otherwise.
| static void CVD::Thread::sleep |
( |
unsigned int |
milli |
) |
[static] |
Tell the current thread to sleep for milli milliseconds.
| void CVD::Thread::start |
( |
Runnable * |
runnable = 0 |
) |
|
Start execution of "run" method in separate thread.
| void CVD::Thread::stop |
( |
|
) |
|
Tell the thread to stop.
This doesn't make the thread actually stop, it just causes shouldStop() to return true.
| static void* CVD::Thread::threadproc |
( |
void * |
param |
) |
[static, private] |
| static void CVD::Thread::yield |
( |
|
) |
[static] |
Tell the current thread to yield the processor.
Member Data Documentation
The documentation for this class was generated from the following file:
libcvd
Author(s): Edward Rosten, Paul Smith, Tom Drummond, Gerhard Reitmayr, Ethan Eade, Timothy Gan, Chris Kemp, Georg Klein
autogenerated on Fri Jan 11 09:13:52 2013