cmdfx 0.3.2
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
20// Global Declarations
21
22int getTickSpeed() {
23 return CmdFX_getTickSpeed();
24}
25
26int setTickSpeed(int tickspeed) {
27 return CmdFX_setTickSpeed(tickspeed);
28}
29
30// Multithreading
31
32ThreadID launchThread(void (*func)(void*), void* arg) {
33 return CmdFX_launchThread(func, arg);
34}
35
36int joinThread(ThreadID thread) {
37 return CmdFX_joinThread(thread);
38}
39
40int detachThread(ThreadID thread) {
41 return CmdFX_detachThread(thread);
42}
43
44void* getInternalMutex(int id) {
45 return CmdFX_getInternalMutex(id);
46}
47
48int lockMutex(void* mutex) {
49 return CmdFX_lockMutex(mutex);
50}
51
52int unlockMutex(void* mutex) {
53 return CmdFX_unlockMutex(mutex);
54}
55
56void tryLockMutex(int id) {
58}
59
60void tryUnlockMutex(int id) {
62}
63
64int isThreadSafeEnabled() {
66}
67
68int initThreadSafe() {
69 return CmdFX_initThreadSafe();
70}
71
72int destroyThreadSafe() {
74}
75
76} // namespace CmdFX
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:26