orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
OrxThread

Macros

#define orxTHREAD_GET_FLAG_FROM_ID(ID)
#define orxTHREAD_KU32_FLAG_NONE   0
#define orxTHREAD_KU32_MAIN_THREAD_ID   0
#define orxTHREAD_KU32_MASK_ALL   (((1 << orxTHREAD_KU32_MAX_THREAD_NUMBER) - 1) & ~(1 << orxTHREAD_KU32_MAIN_THREAD_ID)) /* Mask all (for orxThread_Enable) */
#define orxTHREAD_KU32_MAX_THREAD_NUMBER   16

Typedefs

typedef orxSTATUS(orxFASTCALL * orxTHREAD_FUNCTION) (void *_pContext)
typedef struct __orxTHREAD_SEMAPHORE_t orxTHREAD_SEMAPHORE

Functions

orxDLLAPI orxTHREAD_SEMAPHORE *orxFASTCALL orxThread_CreateSemaphore (orxU32 _u32Value)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_DeleteSemaphore (orxTHREAD_SEMAPHORE *_pstSemaphore)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Enable (orxU32 _u32EnableThreads, orxU32 _u32DisableThreads)
orxDLLAPI void orxFASTCALL orxThread_Exit ()
orxDLLAPI orxU32 orxFASTCALL orxThread_GetCurrent ()
orxDLLAPI const orxSTRING orxFASTCALL orxThread_GetName (orxU32 _u32ThreadID)
orxDLLAPI orxU32 orxFASTCALL orxThread_GetTaskCount ()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Init ()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Join (orxU32 _u32ThreadID)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_JoinAll ()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_RunTask (const orxTHREAD_FUNCTION _pfnRun, const orxTHREAD_FUNCTION _pfnThen, const orxTHREAD_FUNCTION _pfnElse, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_SetCallbacks (const orxTHREAD_FUNCTION _pfnStart, const orxTHREAD_FUNCTION _pfnStop, void *_pContext)
orxDLLAPI void orxFASTCALL orxThread_Setup ()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_SignalSemaphore (orxTHREAD_SEMAPHORE *_pstSemaphore)
orxDLLAPI orxU32 orxFASTCALL orxThread_Start (const orxTHREAD_FUNCTION _pfnRun, const orxSTRING _zName, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_WaitSemaphore (orxTHREAD_SEMAPHORE *_pstSemaphore)
orxDLLAPI void orxFASTCALL orxThread_Yield ()

Detailed Description

Thread file Code that handles threads

Macro Definition Documentation

◆ orxTHREAD_GET_FLAG_FROM_ID

#define orxTHREAD_GET_FLAG_FROM_ID ( ID)
Value:
(1 << (ID))

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

Main thread ID

Definition at line 55 of file orxThread.h.

◆ orxTHREAD_KU32_MASK_ALL

#define orxTHREAD_KU32_MASK_ALL   (((1 << orxTHREAD_KU32_MAX_THREAD_NUMBER) - 1) & ~(1 << orxTHREAD_KU32_MAIN_THREAD_ID)) /* Mask all (for orxThread_Enable) */

Definition at line 59 of file orxThread.h.

◆ orxTHREAD_KU32_MAX_THREAD_NUMBER

#define orxTHREAD_KU32_MAX_THREAD_NUMBER   16

Max thread number

Definition at line 56 of file orxThread.h.

Typedef Documentation

◆ orxTHREAD_FUNCTION

typedef orxSTATUS(orxFASTCALL * orxTHREAD_FUNCTION) (void *_pContext)

Thread run function type

Definition at line 68 of file orxThread.h.

◆ orxTHREAD_SEMAPHORE

typedef struct __orxTHREAD_SEMAPHORE_t orxTHREAD_SEMAPHORE

Semaphore structure

Definition at line 64 of file orxThread.h.

Function Documentation

◆ orxThread_CreateSemaphore()

orxDLLAPI orxTHREAD_SEMAPHORE *orxFASTCALL orxThread_CreateSemaphore ( orxU32 _u32Value)
extern

Inits a semaphore with a given value

Parameters
[in]_u32ValueValue with which to init the semaphore
Returns
orxTHREAD_SEMAPHORE / orxNULL

◆ orxThread_DeleteSemaphore()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_DeleteSemaphore ( orxTHREAD_SEMAPHORE * _pstSemaphore)
extern

Deletes a semaphore

Parameters
[in]_pstSemaphoreConcerned semaphore
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_Enable()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_Enable ( orxU32 _u32EnableThreads,
orxU32 _u32DisableThreads )
extern

Enables / disables threads

Parameters
[in]_u32EnableThreadsMask of threads to enable (1 << ThreadID)
[in]_u32DisableThreadsMask 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]_u32ThreadIDID 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()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_Init ( )
extern

Inits the thread module

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_Join()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_Join ( orxU32 _u32ThreadID)
extern

Joins a thread (blocks & waits until the other thread finishes)

Parameters
[in]_u32ThreadIDID of the thread for which to wait
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_JoinAll()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_JoinAll ( )
extern

Joins all threads (blocks & waits until the other threads finish)

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_RunTask()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_RunTask ( const orxTHREAD_FUNCTION _pfnRun,
const orxTHREAD_FUNCTION _pfnThen,
const orxTHREAD_FUNCTION _pfnElse,
void * _pContext )
extern

Runs an asynchronous task and optional follow-ups

Parameters
[in]_pfnRunAsynchronous task to run, executed on a different thread dedicated to tasks, if orxNULL defaults to an empty task that always succeed
[in]_pfnThenExecuted (on the main thread) if Run does not return orxSTATUS_FAILURE, can be orxNULL
[in]_pfnElseExecuted (on the main thread) if Run returns orxSTATUS_FAILURE, can be orxNULL
[in]_pContextContext that will be transmitted to all the task functions
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_SetCallbacks()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_SetCallbacks ( const orxTHREAD_FUNCTION _pfnStart,
const orxTHREAD_FUNCTION _pfnStop,
void * _pContext )
extern

Sets callbacks to run when starting and stopping new threads

Parameters
[in]_pfnStartFunction to run whenever a new thread is started
[in]_pfnStopFunction to run whenever a thread is stopped
[in]_pContextContext that will be transmitted to each callback
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_Setup()

orxDLLAPI void orxFASTCALL orxThread_Setup ( )
extern

Thread module setup

◆ orxThread_SignalSemaphore()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_SignalSemaphore ( orxTHREAD_SEMAPHORE * _pstSemaphore)
extern

Signals a semaphore

Parameters
[in]_pstSemaphoreConcerned semaphore
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_Start()

orxDLLAPI orxU32 orxFASTCALL orxThread_Start ( const orxTHREAD_FUNCTION _pfnRun,
const orxSTRING _zName,
void * _pContext )
extern

Starts a new thread

Parameters
[in]_pfnRunFunction to run on the new thread
[in]_zNameThread's name
[in]_pContextContext that will be transmitted to the function when called
Returns
Thread ID if successful, orxU32_UNDEFINED otherwise

◆ orxThread_WaitSemaphore()

orxDLLAPI orxSTATUS orxFASTCALL orxThread_WaitSemaphore ( orxTHREAD_SEMAPHORE * _pstSemaphore)
extern

Waits for a semaphore

Parameters
[in]_pstSemaphoreConcerned semaphore
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxThread_Yield()

orxDLLAPI void orxFASTCALL orxThread_Yield ( )
extern

Yields to other threads


Generated for orx by doxygen 1.8.11