File Thread.h
FileList > engine > include > Thread.h
Go to the source code of this file
#include <pthread.h>#include <unistd.h>#include <sys/types.h>
Public Types
| Type | Name |
|---|---|
| typedef pthread_mutex_t | CrossPlatformMutex Mutexes - These will work between threads in the same process: in windows terms, a "critical section". |
| typedef pthread_t | CrossPlatformThread |
| typedef pid_t | CrossPlatformThreadID |
| typedef void *(* | ThreadFn Thread functions have return values as required by the OS thread libs but as the win32 thead returns a dword (32bit) and the pthread returns a void* (64 bit), so our abstraction just ignores return values. |
Public Functions
| Type | Name |
|---|---|
| void | DestroyMutex (CrossPlatformMutex * pMtx) |
| CrossPlatformThreadID | GetThisThreadsID () |
| void | InitMutex (CrossPlatformMutex * pMtx) |
| void | JoinThread (CrossPlatformThread pThread) |
| void | LockMutex (CrossPlatformMutex * pMtx) |
| void | SleepForMS (int ms) Make the calling thread sleep for ms milliseconds. |
| CrossPlatformThread | StartThread (ThreadFn thread, void * pUser) Thread functions have return values as required by the OS thread libs but as the win32 thead returns a dword (32bit) and the pthread returns a void* (64 bit), so our abstraction just ignores return values. |
| void | UnlockMutex (CrossPlatformMutex * pMtx) |
Macros
| Type | Name |
|---|---|
| define | DECLARE_THREAD_PROC (name, argName) void\* name (void\* argName) |
| define | _GNU_SOURCE |
Public Types Documentation
typedef CrossPlatformMutex
Mutexes - These will work between threads in the same process: in windows terms, a "critical section".
typedef pthread_mutex_t CrossPlatformMutex;
typedef CrossPlatformThread
typedef pthread_t CrossPlatformThread;
typedef CrossPlatformThreadID
typedef pid_t CrossPlatformThreadID;
typedef ThreadFn
Thread functions have return values as required by the OS thread libs but as the win32 thead returns a dword (32bit) and the pthread returns a void* (64 bit), so our abstraction just ignores return values.
typedef void *(* ThreadFn) (void *);
Public Functions Documentation
function DestroyMutex
void DestroyMutex (
CrossPlatformMutex * pMtx
)
Parameters:
pMtx
function GetThisThreadsID
CrossPlatformThreadID GetThisThreadsID ()
Returns:
function InitMutex
void InitMutex (
CrossPlatformMutex * pMtx
)
Parameters:
pMtx
function JoinThread
void JoinThread (
CrossPlatformThread pThread
)
function LockMutex
void LockMutex (
CrossPlatformMutex * pMtx
)
Parameters:
pMtx
function SleepForMS
Make the calling thread sleep for ms milliseconds.
void SleepForMS (
int ms
)
Parameters:
ms
function StartThread
Thread functions have return values as required by the OS thread libs but as the win32 thead returns a dword (32bit) and the pthread returns a void* (64 bit), so our abstraction just ignores return values.
CrossPlatformThread StartThread (
ThreadFn thread,
void * pUser
)
Parameters:
threadpUser
Returns:
function UnlockMutex
void UnlockMutex (
CrossPlatformMutex * pMtx
)
Parameters:
pMtx
Macro Definition Documentation
define DECLARE_THREAD_PROC
#define DECLARE_THREAD_PROC (
name,
argName
) `void* name (void* argName)`
define _GNU_SOURCE
#define _GNU_SOURCE
The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/include/Thread.h