Isle
Loading...
Searching...
No Matches
MxThread Class Reference

[AI] Abstract thread class providing a platform-independent interface for thread management. More...

#include <mxthread.h>

Inheritance diagram for MxThread:
Collaboration diagram for MxThread:

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

MxCorem_target
 [AI] Pointer to the target object (optional, typically the object being processed by the thread). Offset 0x18 More...
 

Detailed Description

[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.

Constructor & Destructor Documentation

◆ MxThread()

MxThread::MxThread ( )
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.

◆ ~MxThread()

MxThread::~MxThread ( )
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.

Member Function Documentation

◆ IsRunning()

MxBool MxThread::IsRunning ( )
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.

Returns
[AI] TRUE if running, FALSE otherwise.

Definition at line 56 of file mxthread.h.

◆ Run()

MxResult MxThread::Run ( )
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.

Returns
[AI] Success or failure status.

Reimplemented in MxDiskStreamProviderThread, and MxTickleThread.

Definition at line 63 of file mxthread.cpp.

◆ Sleep()

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.

Parameters
p_millisecondsHow long to sleep in milliseconds. [AI]

Definition at line 44 of file mxthread.cpp.

◆ Start()

MxResult MxThread::Start ( MxS32  p_stackSize,
MxS32  p_flag 
)

[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).

Parameters
p_stackSizeAmount of stack to allocate for the thread (in 4-byte units). [AI]
p_flagPass-through flag to the underlying thread creation API. [AI]
Returns
[AI] Returns SUCCESS if the thread was started successfully, otherwise FAILURE.

Definition at line 28 of file mxthread.cpp.

◆ Terminate()

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.

Member Data Documentation

◆ m_target

MxCore* MxThread::m_target
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.


The documentation for this class was generated from the following files: