Classes | |
struct | mutex |
A mutex, or lock. More... | |
struct | thread |
A thread, or separate process. More... | |
Typedefs | |
typedef void(* | thread_function) () |
thread_function is a wrapper for functions of all return types. More... | |
Functions | |
EXPORT_SYM mutex | mutex_create () |
EXPORT_SYM void | mutex_lock (mutex m) |
EXPORT_SYM int | mutex_trylock (mutex m) |
EXPORT_SYM void | mutex_unlock (mutex m) |
EXPORT_SYM void | mutex_destroy (mutex m) |
EXPORT_SYM thread | thread_create (thread_function func) |
EXPORT_SYM void | thread_start (thread id) |
EXPORT_SYM void | thread_wait (thread id) |
EXPORT_SYM void | thread_destroy (thread id) |
typedef void(* thread_function) () |
thread_function is a wrapper for functions of all return types.
thread_function is defined so that any function will be accepted by thread_start by automatically casting it to a thread_function so functions with all return types, whether int, float, etc, can be threaded
EXPORT_SYM mutex mutex_create | ( | ) |
Create a mutex.
EXPORT_SYM void mutex_destroy | ( | mutex | m | ) |
Destroy the mutex. This is used for cleanup after your program has finished with the mutex.
EXPORT_SYM void mutex_lock | ( | mutex | m | ) |
Locks the mutex. This means that only the thread that locked the mutex will run until the mutex is unlocked.
EXPORT_SYM int mutex_trylock | ( | mutex | m | ) |
EXPORT_SYM void mutex_unlock | ( | mutex | m | ) |
Unlocks the mutex. This means that other threads (if present) will run again.
EXPORT_SYM thread thread_create | ( | thread_function | func | ) |
Create a thread that will run the given function.
func | The function that the thread will run |
EXPORT_SYM void thread_destroy | ( | thread | id | ) |
Destroy the thread. This is used for cleanup after your program has finished with the thread.
EXPORT_SYM void thread_start | ( | thread | id | ) |
Run the given thread
id | The thread to run |
EXPORT_SYM void thread_wait | ( | thread | id | ) |
Wait until the given thread has finished running.
id | The thread to wait for. |