class Thread : private NoCopy
Encapsulation of thread.
Destructor. Performs Detach - thread continues running.
bool Run(Callback cb)
Starts a new thread.
Detaches running thread from the Thread object. It means that thread continues running but is no longer controlled by Thread instance.
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 bool IsMain()
Returns true if current thread is main.
static int GetCount()
Number of running threads.
static void ShutdownThreads()
Sets the "Shutdown" flag on.
static bool IsShutdownThreads()
True if ShutdownThreads was called.
static void (*AtExit(void (*exitfn)()))()
Allow to install a function exitfn to be called at thread exit. Returns the pointer to function already installed or NULL, client code should call the already installed function (return value is not null)
bool Priority(int percent)
Sets the treads priority to percent (0 to 200). In reality, current implementation supports only 5 levels, 25%, 75%, 125%, 175% and more than 175%; last two levels require root priviledges. Returns true if setting the priority was successfull.