cmdfx 0.2.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
util.hpp
Go to the documentation of this file.
1
11#pragma once
12
13extern "C" {
14 #include "cmdfx/core/util.h"
15}
16
17namespace CmdFX {
18
19 // Global Declarations
20
21 int getTickSpeed() {
22 return CmdFX_getTickSpeed();
23 }
24
25 int setTickSpeed(int tickspeed) {
26 return CmdFX_setTickSpeed(tickspeed);
27 }
28
29 // Multithreading
30
31 unsigned long launchThread(void (*func)(void*), void* arg) {
32 return CmdFX_launchThread(func, arg);
33 }
34
35 int joinThread(unsigned long thread) {
36 return CmdFX_joinThread(thread);
37 }
38
39 int detachThread(unsigned long thread) {
40 return CmdFX_detachThread(thread);
41 }
42
43 void* getInternalMutex(int id) {
44 return CmdFX_getInternalMutex(id);
45 }
46
47 int lockMutex(void* mutex) {
48 return CmdFX_lockMutex(mutex);
49 }
50
51 int unlockMutex(void* mutex) {
52 return CmdFX_unlockMutex(mutex);
53 }
54
55 void tryLockMutex(int id) {
57 }
58
59 void tryUnlockMutex(int id) {
61 }
62
63 int isThreadSafeEnabled() {
65 }
66
67 int initThreadSafe() {
68 return CmdFX_initThreadSafe();
69 }
70
71 int destroyThreadSafe() {
73 }
74
75}
Cross-Platform Utilities for CmdFX.
int CmdFX_detachThread(ThreadID thread)
Detaches a thread.
int CmdFX_unlockMutex(void *mutex)
Unlocks a mutex.
int CmdFX_joinThread(ThreadID thread)
Joins a thread.
ThreadID CmdFX_launchThread(void(*func)(void *), void *arg)
Launches a thread.
int CmdFX_isThreadSafeEnabled()
Checks if thread-safe functions are enabled.
void CmdFX_tryUnlockMutex(int id)
Tries to unlock a mutex.
int CmdFX_initThreadSafe()
Initializes thread-safe functions.
int CmdFX_setTickSpeed(int tickspeed)
Sets the tick speed of cmdfx.
int CmdFX_lockMutex(void *mutex)
Locks a mutex.
void CmdFX_tryLockMutex(int id)
Tries to lock a mutex.
int CmdFX_getTickSpeed()
Gets the tick speed of cmdfx.
int CmdFX_destroyThreadSafe()
Cleans up thread-safe functions.
void * CmdFX_getInternalMutex(int index)
Gets an internal mutex.
Primary namespace for CmdFX.
Definition cmdfx.hpp:22