Thread file Code that handles threads
◆ orxTHREAD_GET_FLAG_FROM_ID
#define orxTHREAD_GET_FLAG_FROM_ID |
( |
| ID | ) |
|
Value:Gets thread flag from ID
Definition at line 60 of file orxThread.h.
◆ orxTHREAD_KU32_FLAG_NONE
#define orxTHREAD_KU32_FLAG_NONE 0 |
Flag none (for orxThread_Enable)
Definition at line 58 of file orxThread.h.
◆ orxTHREAD_KU32_MAIN_THREAD_ID
#define orxTHREAD_KU32_MAIN_THREAD_ID 0 |
◆ orxTHREAD_KU32_MASK_ALL
◆ orxTHREAD_KU32_MAX_THREAD_NUMBER
#define orxTHREAD_KU32_MAX_THREAD_NUMBER 16 |
◆ orxTHREAD_FUNCTION
typedef orxSTATUS(orxFASTCALL * orxTHREAD_FUNCTION) (void *_pContext) |
Thread run function type
Definition at line 68 of file orxThread.h.
◆ orxTHREAD_SEMAPHORE
◆ orxThread_CreateSemaphore()
Inits a semaphore with a given value
- Parameters
-
[in] | _u32Value | Value with which to init the semaphore |
- Returns
- orxTHREAD_SEMAPHORE / orxNULL
◆ orxThread_DeleteSemaphore()
Deletes a semaphore
- Parameters
-
[in] | _pstSemaphore | Concerned semaphore |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_Enable()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Enable |
( |
orxU32 | _u32EnableThreads, |
|
|
orxU32 | _u32DisableThreads ) |
|
extern |
Enables / disables threads
- Parameters
-
[in] | _u32EnableThreads | Mask of threads to enable (1 << ThreadID) |
[in] | _u32DisableThreads | Mask of threads to disable (1 << ThreadID) |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_Exit()
orxDLLAPI void orxFASTCALL orxThread_Exit |
( |
| ) |
|
|
extern |
Exits from the thread module
◆ orxThread_GetCurrent()
orxDLLAPI orxU32 orxFASTCALL orxThread_GetCurrent |
( |
| ) |
|
|
extern |
Gets current thread ID
- Returns
- Current thread ID
◆ orxThread_GetName()
orxDLLAPI const orxSTRING orxFASTCALL orxThread_GetName |
( |
orxU32 | _u32ThreadID | ) |
|
|
extern |
Gets a thread name
- Parameters
-
[in] | _u32ThreadID | ID of the concerned thread |
- Returns
- Thread name
◆ orxThread_GetTaskCount()
orxDLLAPI orxU32 orxFASTCALL orxThread_GetTaskCount |
( |
| ) |
|
|
extern |
Gets number of pending asynchronous tasks awaiting full completion (might pump task notifications if called from main thread)
- Returns
- Number of pending asynchronous tasks
◆ orxThread_Init()
Inits the thread module
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_Join()
Joins a thread (blocks & waits until the other thread finishes)
- Parameters
-
[in] | _u32ThreadID | ID of the thread for which to wait |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_JoinAll()
Joins all threads (blocks & waits until the other threads finish)
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_RunTask()
Runs an asynchronous task and optional follow-ups
- Parameters
-
[in] | _pfnRun | Asynchronous task to run, executed on a different thread dedicated to tasks, if orxNULL defaults to an empty task that always succeed |
[in] | _pfnThen | Executed (on the main thread) if Run does not return orxSTATUS_FAILURE, can be orxNULL |
[in] | _pfnElse | Executed (on the main thread) if Run returns orxSTATUS_FAILURE, can be orxNULL |
[in] | _pContext | Context that will be transmitted to all the task functions |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_SetCallbacks()
Sets callbacks to run when starting and stopping new threads
- Parameters
-
[in] | _pfnStart | Function to run whenever a new thread is started |
[in] | _pfnStop | Function to run whenever a thread is stopped |
[in] | _pContext | Context that will be transmitted to each callback |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_Setup()
orxDLLAPI void orxFASTCALL orxThread_Setup |
( |
| ) |
|
|
extern |
◆ orxThread_SignalSemaphore()
Signals a semaphore
- Parameters
-
[in] | _pstSemaphore | Concerned semaphore |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_Start()
Starts a new thread
- Parameters
-
[in] | _pfnRun | Function to run on the new thread |
[in] | _zName | Thread's name |
[in] | _pContext | Context that will be transmitted to the function when called |
- Returns
- Thread ID if successful, orxU32_UNDEFINED otherwise
◆ orxThread_WaitSemaphore()
Waits for a semaphore
- Parameters
-
[in] | _pstSemaphore | Concerned semaphore |
- Returns
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
◆ orxThread_Yield()
orxDLLAPI void orxFASTCALL orxThread_Yield |
( |
| ) |
|
|
extern |