|
class Thread : private NoCopy
Encapsulation of thread.
Thread()
Default constructor.
~Thread()
Destructor. Performs Detach - thread continues running.
bool Run(Callback cb)
Starts a new thread.
void Detach()
Detaches running thread from the Thread object. It means that thread continues running but is no longer controlled by Thread instance.
int Wait()
Waits for started thread to finish. ("join").
bool IsOpen() const
Thread represents an existing thread. Note that the thread can be already finished and not running anymore (calling to Wait in that case returns immediately).
HANDLE GetHandle() const [WIN32]
pthread_t GetHandle() const [POSIX]
Returns platform specific handle of thread.
static void Start(Callback cb)
Starts a thread and returns immediately (you cannot Wait for the thread to finish in this case).
static void Sleep(int ms)
Sleep for a given number of milliseconds.
static bool IsST()
No additional thread was started yet (only the main thread is running so far).
static int GetCount()
Number of running threads.
static void ShutdownThreads()
Sets the "Shutdown" flag on.
static bool IsShutdownThreads()
True if ShutdownThreads was called.
void Priority(int percent)
Sets the treads priority to percent (0 to 100).
|