#include <threadengine_pthread.h>
|
static DWORD WINAPI | Entry (void *parameter) |
|
The ThreadEngine class has the responsibility of initialising Thread derived classes. It does this by creating operating system level threads which are then associated with the class transparently. This allows Thread classes to be derived without needing to know how the OS implements threads. You should ensure that any sections of code that use threads are threadsafe and do not interact with any other parts of the code which are NOT known threadsafe! If you really MUST access non-threadsafe code from a Thread, use the Mutex class to wrap access to the code carefully.
◆ Start() [1/2]
void ThreadEngine::Start |
( |
Thread * |
thread_to_init | ) |
|
Create a new thread. This takes an already allocated Thread* pointer and initializes it to use this threading engine. On failure, this function may throw a CoreException.
- Parameters
-
thread_to_init | Pointer to a newly allocated Thread derived object. |
◆ Start() [2/2]
void ThreadEngine::Start |
( |
Thread * |
thread_to_init | ) |
|
Create a new thread. This takes an already allocated Thread* pointer and initializes it to use this threading engine. On failure, this function may throw a CoreException.
- Parameters
-
thread_to_init | Pointer to a newly allocated Thread derived object. |
◆ Stop() [1/2]
void ThreadEngine::Stop |
( |
Thread * |
thread | ) |
|
Stop a thread gracefully. First, this function asks the thread to terminate by calling Thread::SetExitFlag(). Next, it waits until the thread terminates (on the operating system level). Finally, all OS-level resources associated with the thread are released. The Thread instance passed to the function is NOT freed. When this function returns, the thread is stopped and you can destroy it or restart it at a later point. Stopping a thread that is not running is a bug.
- Parameters
-
thread | The thread to stop. |
◆ Stop() [2/2]
void ThreadEngine::Stop |
( |
Thread * |
thread | ) |
|
Stop a thread gracefully. First, this function asks the thread to terminate by calling Thread::SetExitFlag(). Next, it waits until the thread terminates (on the operating system level). Finally, all OS-level resources associated with the thread are released. The Thread instance passed to the function is NOT freed. When this function returns, the thread is stopped and you can destroy it or restart it at a later point. Stopping a thread that is not running is a bug.
- Parameters
-
thread | The thread to stop. |
The documentation for this class was generated from the following files: