orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
orxThread.h
Go to the documentation of this file.
1/* Orx - Portable Game Engine
2 *
3 * Copyright (c) 2008- Orx-Project
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source
22 * distribution.
23 */
24
32
41
42
43#ifndef _orxTHREAD_H_
44#define _orxTHREAD_H_
45
46#include "orxInclude.h"
47
48#ifdef __orxWINDOWS__
49 #include "memory/orxMemory.h"
50#else /* __orxWINDOWS__ */
51 #include <semaphore.h>
52#endif /* __orxWINDOWS__ */
53
54
55#define orxTHREAD_KU32_MAIN_THREAD_ID 0
56#define orxTHREAD_KU32_MAX_THREAD_NUMBER 16
57
58#define orxTHREAD_KU32_FLAG_NONE 0
59#define orxTHREAD_KU32_MASK_ALL (((1 << orxTHREAD_KU32_MAX_THREAD_NUMBER) - 1) & ~(1 << orxTHREAD_KU32_MAIN_THREAD_ID)) /* Mask all (for orxThread_Enable) */
60#define orxTHREAD_GET_FLAG_FROM_ID(ID) (1 << (ID))
61
62
64typedef struct __orxTHREAD_SEMAPHORE_t orxTHREAD_SEMAPHORE;
65
66
68typedef orxSTATUS (orxFASTCALL *orxTHREAD_FUNCTION)(void *_pContext);
69
70
73extern orxDLLAPI void orxFASTCALL orxThread_Setup();
74
78extern orxDLLAPI orxSTATUS orxFASTCALL orxThread_Init();
79
82extern orxDLLAPI void orxFASTCALL orxThread_Exit();
83
84
91extern orxDLLAPI orxU32 orxFASTCALL orxThread_Start(const orxTHREAD_FUNCTION _pfnRun, const orxSTRING _zName, void *_pContext);
92
97extern orxDLLAPI orxSTATUS orxFASTCALL orxThread_Join(orxU32 _u32ThreadID);
98
103
108extern orxDLLAPI const orxSTRING orxFASTCALL orxThread_GetName(orxU32 _u32ThreadID);
109
115extern orxDLLAPI orxSTATUS orxFASTCALL orxThread_Enable(orxU32 _u32EnableThreads, orxU32 _u32DisableThreads);
116
120extern orxDLLAPI orxU32 orxFASTCALL orxThread_GetCurrent();
121
124extern orxDLLAPI void orxFASTCALL orxThread_Yield();
125
126
131extern orxDLLAPI orxTHREAD_SEMAPHORE *orxFASTCALL orxThread_CreateSemaphore(orxU32 _u32Value);
132
138
144
150
151
159extern orxDLLAPI orxSTATUS orxFASTCALL orxThread_RunTask(const orxTHREAD_FUNCTION _pfnRun, const orxTHREAD_FUNCTION _pfnThen, const orxTHREAD_FUNCTION _pfnElse, void *_pContext);
160
164extern orxDLLAPI orxU32 orxFASTCALL orxThread_GetTaskCount();
165
172extern orxDLLAPI orxSTATUS orxFASTCALL orxThread_SetCallbacks(const orxTHREAD_FUNCTION _pfnStart, const orxTHREAD_FUNCTION _pfnStop, void *_pContext);
173
174#endif /* _orxTHREAD_H_ */
175
#define orxDLLAPI
Definition orxDecl.h:381
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Enable(orxU32 _u32EnableThreads, orxU32 _u32DisableThreads)
orxDLLAPI void orxFASTCALL orxThread_Exit()
orxSTATUS(orxFASTCALL * orxTHREAD_FUNCTION)(void *_pContext)
Definition orxThread.h:68
struct __orxTHREAD_SEMAPHORE_t orxTHREAD_SEMAPHORE
Definition orxThread.h:64
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Init()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_DeleteSemaphore(orxTHREAD_SEMAPHORE *_pstSemaphore)
orxDLLAPI void orxFASTCALL orxThread_Yield()
orxDLLAPI void orxFASTCALL orxThread_Setup()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_Join(orxU32 _u32ThreadID)
orxDLLAPI orxTHREAD_SEMAPHORE *orxFASTCALL orxThread_CreateSemaphore(orxU32 _u32Value)
orxDLLAPI const orxSTRING orxFASTCALL orxThread_GetName(orxU32 _u32ThreadID)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_RunTask(const orxTHREAD_FUNCTION _pfnRun, const orxTHREAD_FUNCTION _pfnThen, const orxTHREAD_FUNCTION _pfnElse, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_SignalSemaphore(orxTHREAD_SEMAPHORE *_pstSemaphore)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_SetCallbacks(const orxTHREAD_FUNCTION _pfnStart, const orxTHREAD_FUNCTION _pfnStop, void *_pContext)
orxDLLAPI orxU32 orxFASTCALL orxThread_GetCurrent()
orxDLLAPI orxU32 orxFASTCALL orxThread_Start(const orxTHREAD_FUNCTION _pfnRun, const orxSTRING _zName, void *_pContext)
orxDLLAPI orxSTATUS orxFASTCALL orxThread_WaitSemaphore(orxTHREAD_SEMAPHORE *_pstSemaphore)
orxDLLAPI orxU32 orxFASTCALL orxThread_GetTaskCount()
orxDLLAPI orxSTATUS orxFASTCALL orxThread_JoinAll()
orxSTATUS
Definition orxType.h:270

Generated for orx by doxygen 1.8.11