Threading library for C that works across windows and linux
Thread type of this library.
Type for arg of functions for the thread, should be void ptr.
Function type for the thread, should return void and have one cpctu_arg_type argument.
Creates a thread that calls a function with an argument.
Joins a thread.
Sleeps the calling thread for some time.
Sleeps the calling thread with nanosecond precision.
Counts the number of threads used by the current process.
Counts total number of processors in the computer.
Initializes thread forking.
Returns zero if fork is already initialized.
func void cpctu_thread_fork(cpctu_func_type iftc, cpctu_func_type ff, cpctu_arg_type ifa, cpctu_arg_type ffa)
Parameters are initial function, fork function, and their respective arguments.
Calls the function iftc, when it returns, function ff is called in a new thread, and the function iftc is called again, and the process repeats.
This function will block the calling thread, the fork has to be stopped in a different thread.
You cannot call this function more than once in the same process, unless you stop it first.
Stops and releases fork resources. This function should be called in a different thread than the thread cpctu_thread_fork was called in.
Defines future functions and structs for functions that take arg as the parameter type and has ret as the return type.
This function is defined by the macro cpctu_future_type.
Calls the function func asynchronously with aval as the argument.
This function will heuristically decide whether the given function will be evaluated asynchronously or lazily.
This function is defined by the macro cpctu_future_type.
Calls the function func asynchronously with aval as the argument.
This function guarantees the given function will be evaluated asynchronously.
This function is defined by the macro cpctu_future_type.
Calls the function func asynchronously with aval as the argument.
This function guarentees the given function will be lazily evaluated.
This function is defined by the macro cpctu_future_type.
Retrieves the return value fo the function that was called asynchronously, waiting for it to complete if need be.