#./fio-stl/002 threads.h
32 public symbols.
#Macros
#FIO_THREAD_MUTEX_INIT
#define FIO_THREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZERUsed this macro for static initialization.
Symbol type: macro
#FIO_MEMCPY_THREADS
#define FIO_MEMCPY_THREADS 8Symbol type: macro
#Types
#fio_thread_t
typedef pthread_t fio_thread_tSymbol type: type
#fio_thread_pid_t
typedef pid_t fio_thread_pid_tSymbol type: type
#fio_thread_mutex_t
typedef pthread_mutex_t fio_thread_mutex_tSymbol type: type
#fio_thread_cond_t
typedef pthread_cond_t fio_thread_cond_tSymbol type: type
#fio_thread_priority_e
typedef enum {
FIO_THREAD_PRIORITY_ERROR = -1,
FIO_THREAD_PRIORITY_LOWEST = 0,
FIO_THREAD_PRIORITY_LOW,
FIO_THREAD_PRIORITY_NORMAL,
FIO_THREAD_PRIORITY_HIGH,
FIO_THREAD_PRIORITY_HIGHEST,
} fio_thread_priority_ePossible thread priority values.
Symbol type: type
#Functions
#fio_thread_fork
inline fio_thread_pid_t fio_thread_fork(void)Should behave the same as the POSIX system call fork.
Symbol type: function
#fio_thread_getpid
inline fio_thread_pid_t fio_thread_getpid(void)Should behave the same as the POSIX system call getpid.
Symbol type: function
#fio_thread_kill
inline int fio_thread_kill(fio_thread_pid_t pid, int sig)Should behave the same as the POSIX system call kill.
Symbol type: function
#fio_thread_waitpid
inline int fio_thread_waitpid(fio_thread_pid_t pid, int *stat_loc, int options)Should behave the same as the POSIX system call waitpid.
Symbol type: function
#fio_thread_create
inline int fio_thread_create(fio_thread_t *t, void *(*fn)(void *), void *arg)Starts a new thread, returns 0 on success and -1 on failure.
Symbol type: function
#fio_thread_join
inline int fio_thread_join(fio_thread_t *t)Waits for the thread to finish.
Symbol type: function
#fio_thread_detach
inline int fio_thread_detach(fio_thread_t *t)Detaches the thread, so thread resources are freed automatically.
Symbol type: function
#fio_thread_exit
inline void fio_thread_exit(void)Ends the current running thread.
Symbol type: function
#fio_thread_equal
inline int fio_thread_equal(fio_thread_t *a, fio_thread_t *b)Symbol type: function
#fio_thread_current
inline fio_thread_t fio_thread_current(void)Returns the current thread.
Symbol type: function
#fio_thread_nid
inline uintptr_t fio_thread_nid(void)Returns a process-local numeral ID for the current thread.
The value is stable for the thread's lifetime and unique among live threads. It may be reused after the thread exits.
Symbol type: function
#fio_thread_yield
inline void fio_thread_yield(void)Yields thread execution.
Symbol type: function
#fio_thread_priority
FIO_SFUNC fio_thread_priority_e fio_thread_priority(void)Returns a thread's priority level.
Symbol type: function
#fio_thread_priority_set
FIO_SFUNC int fio_thread_priority_set(fio_thread_priority_e)Sets a thread's priority level.
Symbol type: function
#fio_thread_mutex_init
inline int fio_thread_mutex_init(fio_thread_mutex_t *m)Initializes a simple Mutex.
Or use the static initialization value: FIO_THREAD_MUTEX_INIT
Symbol type: function
#fio_thread_mutex_lock
inline int fio_thread_mutex_lock(fio_thread_mutex_t *m)Locks a simple Mutex, returning -1 on error.
Symbol type: function
#fio_thread_mutex_trylock
inline int fio_thread_mutex_trylock(fio_thread_mutex_t *m)Attempts to lock a simple Mutex, returning zero on success.
Symbol type: function
#fio_thread_mutex_unlock
inline int fio_thread_mutex_unlock(fio_thread_mutex_t *m)Unlocks a simple Mutex, returning zero on success or -1 on error.
Symbol type: function
#fio_thread_mutex_destroy
inline void fio_thread_mutex_destroy(fio_thread_mutex_t *m)Destroys the simple Mutex (cleanup).
Symbol type: function
#fio_thread_cond_init
inline int fio_thread_cond_init(fio_thread_cond_t *c)Initializes a simple conditional variable.
Symbol type: function
#fio_thread_cond_wait
inline int fio_thread_cond_wait(fio_thread_cond_t *c, fio_thread_mutex_t *m)Waits on a conditional variable (MUST be previously locked).
Symbol type: function
#fio_thread_cond_timedwait
inline int fio_thread_cond_timedwait(fio_thread_cond_t *c, fio_thread_mutex_t *m, size_t milliseconds)Waits on a conditional variable (MUST be previously locked).
Symbol type: function
#fio_thread_cond_signal
inline int fio_thread_cond_signal(fio_thread_cond_t *c)Signals a simple conditional variable.
Symbol type: function
#fio_thread_cond_destroy
inline void fio_thread_cond_destroy(fio_thread_cond_t *c)Destroys a simple conditional variable.
Symbol type: function
#fio_thread_memcpy
FIO_SFUNC size_t fio_thread_memcpy(void *restrict dest, const void *restrict src, size_t bytes)Multi-threaded memcpy using up to FIO_MEMCPY_THREADS threads
Symbol type: function