Thread Class Reference

Thread class, encapsulates a thread, its properties and its functions. More...

List of all members.

Public Member Functions

void resume ()
 Resumes a thread again after suspend.
void suspend ()
 Suspends the thread until resume is called on the thread again.
void terminate (unsigned long exitCode)
 Terminates the thread !! (CAUTION).
 Thread ()
 Empty Constructor, doesn't alloc any resources or anything...
 Thread (HANDLE thread)
 Constructor taking a thread handle.

Static Public Member Functions

static void waitForObjects (const std::vector< Thread > &threads)
 Wait for multiple threads to finish.


Detailed Description

Thread class, encapsulates a thread, its properties and its functions.

This class encapsulates a thread and its functions. To actually create and start a thread use the fork function of the Widget you wish to create the thread within...


Member Function Documentation

void resume (  ) 

Resumes a thread again after suspend.

Call suspend to stop the thread from executing and call resume to get it running again

void suspend (  ) 

Suspends the thread until resume is called on the thread again.

Basically pauses the thread until resume is called on the thread

void terminate ( unsigned long  exitCode  ) 

Terminates the thread !! (CAUTION).

WARNING!!!
This function will IMMEDIATELY terminate the thread, this means that the thread will NOT get to do ANY house cleaning at ALL. The thread will IMMEDIATELY be terminated and it will not get to do anything at all, for instance it will not be able to delete its heaped memory or finish its current line of execution etc... This is a LAST RESORT function only meant in very critical situations where you really need to terminate the thread and kill its execution!

static void waitForObjects ( const std::vector< Thread > &  threads  )  [static]

Wait for multiple threads to finish.

If you have for instance 3 different threads that must finish their current work before you can continue execution in another thread then call this function with the threads to wait for as the contents of the vector. Note!
If the thread you are waiting for is manipulating GUI in some way then you are likely to experience a deadlock here if you call this one on the main thread since the message handling will then be halted (since you called it on the main thread)

Back to SmartWin website
SourceForge.net Logo