Stardew Engine
Loading...
Searching...
No Matches
Thread.h File Reference
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
Include dependency graph for Thread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 
#define DECLARE_THREAD_PROC(name, argName)   void* name (void* argName)
 

Typedefs

typedef void *(* ThreadFn) (void *)
 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 pthread_t CrossPlatformThread
 
typedef pthread_mutex_t CrossPlatformMutex
 Mutexes - These will work between threads in the same process: in windows terms, a "critical section".
 
typedef pid_t CrossPlatformThreadID
 

Functions

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 JoinThread (CrossPlatformThread pThread)
 
void InitMutex (CrossPlatformMutex *pMtx)
 
void DestroyMutex (CrossPlatformMutex *pMtx)
 
void LockMutex (CrossPlatformMutex *pMtx)
 
void UnlockMutex (CrossPlatformMutex *pMtx)
 
CrossPlatformThreadID GetThisThreadsID ()
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ DECLARE_THREAD_PROC

#define DECLARE_THREAD_PROC (   name,
  argName 
)    void* name (void* argName)

Typedef Documentation

◆ CrossPlatformMutex

typedef pthread_mutex_t CrossPlatformMutex

Mutexes - These will work between threads in the same process: in windows terms, a "critical section".

◆ CrossPlatformThread

typedef pthread_t CrossPlatformThread

◆ CrossPlatformThreadID

typedef pid_t CrossPlatformThreadID

◆ ThreadFn

typedef void *(* ThreadFn) (void *)

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.

Function Documentation

◆ DestroyMutex()

void DestroyMutex ( CrossPlatformMutex pMtx)
Parameters
pMtx

◆ GetThisThreadsID()

CrossPlatformThreadID GetThisThreadsID ( )
Returns

◆ InitMutex()

void InitMutex ( CrossPlatformMutex pMtx)
Parameters
pMtx

◆ JoinThread()

void JoinThread ( CrossPlatformThread  pThread)

◆ LockMutex()

void LockMutex ( CrossPlatformMutex pMtx)
Parameters
pMtx

◆ StartThread()

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.

Parameters
thread
pUser
Returns

◆ UnlockMutex()

void UnlockMutex ( CrossPlatformMutex pMtx)
Parameters
pMtx