|
libclod
C library for interacting with NBTs, region files, LOD data and other things.
|
Classes | |
| struct | clod_process_opts |
Macros | |
| #define | CLOD_SPINLOCK_INIT 0 |
| #define | CLOD_ONCE_INIT 0 |
| #define | CLOD_ONCE(once) |
| #define | CLOD_MUTEX_INIT 0 |
Typedefs | |
| typedef int | clod_process_main(int argc, char **argv) |
| typedef uintptr_t | clod_process |
| typedef char | clod_spinlock |
| typedef char | clod_once |
| typedef int | clod_mutex |
Enumerations | |
| enum | clod_process_type { CLOD_THREAD = 1 , CLOD_THREAD_BACKGROUND = 2 , CLOD_DAEMON = 3 } |
| enum | clod_process_result { CLOD_PROCESS_OK = 0 , CLOD_PROCESS_INVALID = 1 , CLOD_PROCESS_NO_MEMORY = 2 , CLOD_PROCESS_UNSUPPORTED = 3 } |
Functions | |
| enum clod_process_result | clod_process_start (struct clod_process_opts *opts, clod_process *process_out) |
| enum clod_process_result | clod_process_join (clod_process process) |
| void | clod_spinlock_lock (clod_spinlock *spinlock) |
| void | clod_spinlock_unlock (clod_spinlock *spinlock) |
| bool | clod_once_do (clod_once *once) |
| void | clod_once_done (clod_once *once) |
| int64_t | clod_timer (int64_t *time, int64_t duration_us) |
| void | clod_mutex_lock (clod_mutex *mutex) |
| void | clod_mutex_unlock (clod_mutex *mutex) |
Threading API. Implements threading from scratch, but since doing so forfeits the use of libc, also wraps libc threading APIs.
| #define CLOD_ONCE | ( | once | ) |
| typedef char clod_spinlock |
| typedef char clod_once |
| typedef int clod_mutex |
| enum clod_process_type |
| enum clod_process_result clod_process_start | ( | struct clod_process_opts * | opts, |
| clod_process * | process_out ) |
| enum clod_process_result clod_process_join | ( | clod_process | process | ) |
| void clod_spinlock_lock | ( | clod_spinlock * | spinlock | ) |
| void clod_spinlock_unlock | ( | clod_spinlock * | spinlock | ) |
Unlock a spinlock.
| spinlock | The spinlock to lock. |
Definition at line 26 of file spinlock.c.
| bool clod_once_do | ( | clod_once * | once | ) |
| void clod_once_done | ( | clod_once * | once | ) |
| int64_t clod_timer | ( | int64_t * | time, |
| int64_t | duration_us ) |
Multi-use time function. Can be used to get the current time, wait for a specific time in the future, wait some duration from the current time or easily implement a repeating task that avoids time drift.
| [in,out] | time | (nullable) Time in microseconds from an undefined epoch. If time is null, the method simply waits for duration_us. The duration is added to the value in time, unless the method is interrupted by a signal or an error occurs, in which case time is not updated. If time is null it does not return when interrupted by a signal. |
| [in] | duration_us | Duration after time to wait for. If duration_us is <= 0, it simply returns the current time. |
| void clod_mutex_lock | ( | clod_mutex * | mutex | ) |
| void clod_mutex_unlock | ( | clod_mutex * | mutex | ) |