Isle
|
[AI] Abstract thread class providing a platform-independent interface for thread management. More...
#include <mxthread.h>
Public Member Functions | |
virtual MxResult | Run () |
[AI] Virtual function executed when the thread runs. More... | |
MxResult | Start (MxS32 p_stackSize, MxS32 p_flag) |
[AI] Starts the thread with a given stack size and creation flags. More... | |
void | Terminate () |
[AI] Signals the thread to terminate. More... | |
void | Sleep (MxS32 p_milliseconds) |
[AI] Sleeps the current thread for the given duration in milliseconds. More... | |
MxBool | IsRunning () |
[AI] Returns whether the thread is currently running. More... | |
virtual | ~MxThread () |
[AI] Virtual destructor for MxThread. More... | |
Protected Member Functions | |
MxThread () | |
[AI] Protected constructor for MxThread. More... | |
Protected Attributes | |
MxCore * | m_target |
[AI] Pointer to the target object (optional, typically the object being processed by the thread). Offset 0x18 More... | |
[AI] Abstract thread class providing a platform-independent interface for thread management.
[AI] MxThread encapsulates thread creation, synchronization, and control, allowing derived classes to implement their own logic in the Run() function. Used for background processing such as streaming or resource loading.
Definition at line 17 of file mxthread.h.
|
protected |
[AI] Protected constructor for MxThread.
[AI] Initializes thread handles and running state. Should only be constructed by derived classes.
Definition at line 10 of file mxthread.cpp.
|
virtual |
[AI] Virtual destructor for MxThread.
[AI] Cleans up system resources associated with the thread, if any exist.
Definition at line 18 of file mxthread.cpp.
|
inline |
[AI] Returns whether the thread is currently running.
[AI] Returns the value of m_running, which should be TRUE if the thread is running and FALSE if it has been terminated.
Definition at line 56 of file mxthread.h.
|
virtual |
[AI] Virtual function executed when the thread runs.
[AI] This method is expected to be overridden by derived classes to implement specific thread logic. The base implementation simply releases the semaphore and returns SUCCESS.
Reimplemented in MxDiskStreamProviderThread, and MxTickleThread.
Definition at line 63 of file mxthread.cpp.
void MxThread::Sleep | ( | MxS32 | p_milliseconds | ) |
[AI] Sleeps the current thread for the given duration in milliseconds.
[AI] This is a wrapper over the OS sleep API. The current executing thread (not necessarily this MxThread) is paused.
p_milliseconds | How long to sleep in milliseconds. [AI] |
Definition at line 44 of file mxthread.cpp.
[AI] Starts the thread with a given stack size and creation flags.
[AI] Initializes the semaphore and creates a new thread in the system using the specified stack size and flags. The thread executes ThreadProc, which calls Run() on this instance. The method is platform-specific (Windows).
p_stackSize | Amount of stack to allocate for the thread (in 4-byte units). [AI] |
p_flag | Pass-through flag to the underlying thread creation API. [AI] |
Definition at line 28 of file mxthread.cpp.
void MxThread::Terminate | ( | ) |
[AI] Signals the thread to terminate.
[AI] Sets the m_running flag to FALSE and blocks until the semaphore is released, ensuring that the thread finishes execution gracefully.
Definition at line 50 of file mxthread.cpp.
|
protected |
[AI] Pointer to the target object (optional, typically the object being processed by the thread). Offset 0x18
Definition at line 90 of file mxthread.h.