#include <support/Thread.h>
Inheritance diagram for SThread:
Don't use this unless you have a good reason to do so. Most threading needs can be served by sending messages to a BHandler, which (a) is easier to use; (b) consumes much less resources; (c) more flexible; and (d) will probably let you avoid some amount of pain down the road. However, if you've really absolutely gotta have your own thread, here it is. Have fun.
Public Member Functions | |
virtual void | RequestExit () |
Request for the object's thread to exit. | |
virtual status_t | Run (const char *name, int32_t priority, size_t stackSize) |
Start the thread. | |
SThread () | |
void | WaitForExit () |
Block until this object's thread exits. BEWARE DEADLOCKS! | |
Protected Member Functions | |
virtual status_t | AboutToRun (SysHandle thread) |
Called after the thread is created but before started to give derived classes a chance to do stuff. | |
bool | ExitRequested () const |
Return true if RequestExit() has been called. | |
virtual bool | ThreadEntry ()=0 |
Main entry of thread. | |
virtual | ~SThread () |
|
|
|
|
|
Called after the thread is created but before started to give derived classes a chance to do stuff.
|
|
Return true if RequestExit() has been called.
|
|
Request for the object's thread to exit. Returns immediately; does not wait for the thread to actually do so. Note that the thread itself must take care of handling this -- either by looping or explicitly checking with ExitRequested(). |
|
Start the thread. Returns B_OK if it is off and running. The thread is assigned the given name, standard priority level at which to run, and number of bytes to allocate for its stack. |
|
Main entry of thread. Two models of execution are supported. Looping: If you return true from this function, it will be called again if (a) someone still holds a reference on the object; and (b) RequestExit() has not been called. Thus your thread will continually perform some action until the object goes away or someone requests for it to end. One-shot: If you return false from this function, the thread will immediately exit. |
|
Block until this object's thread exits. BEWARE DEADLOCKS!
|