Common thread functions. More...
#include <stddef.h>#include <stdbool.h>Typedefs | |
| typedef struct Thread_T | Thread_T | 
| Thread structure.  | |
| typedef Thread_T * | Thread | 
| Thread instance.  | |
Functions | |
| Thread | createThread (void(*function)(void *), void *argument) | 
| Creates a new thread executing the specified function.   | |
| void | destroyThread (Thread thread) | 
| Destroys thread instance.   | |
| void | joinThread (Thread thread) | 
| Blocks the current thread until the function execution end.   | |
| void | sleepThread (double delay) | 
| Blocks the execution of the current thread for a specified time.   | |
| bool | yieldThread () | 
| Causes the current thread to yield execution to another thread.   | |
| bool | isThreadJoined (Thread thread) | 
| Returns thread current join status.   | |
| bool | isThreadCurrent (Thread thread) | 
| Returns true if thread is currently running one.   | |
| const void * | getThreadNative (Thread thread) | 
| Returns pointer to the native thread handle.   | |
| void | setMainThread () | 
| Sets current thread as main.  | |
| bool | isCurrentThreadMain () | 
| Returns true if current thread is main.  | |
| bool | isThreadMain (Thread thread) | 
| Returns true if thread is main.   | |
| void | getThreadName (char *name, size_t size) | 
| Returns current thread name.   | |
| void | setThreadName (const char *name) | 
| Sets current thread name.   | |
| void | setThreadForegroundPriority () | 
| Sets current thread priority to foreground.  | |
| void | setThreadBackgroundPriority () | 
| Sets current thread priority to background.  | |
Common thread functions.
A thread is the smallest unit of execution within a process. Threads are parallel execution paths that can run independently but share the same resources, such as memory space, file descriptors, and other process-specific information. Threads enable concurrent execution and can be used to perform multiple tasks simultaneously within a single process.
| Thread createThread | ( | void(* | function )(void *), | 
| void * | argument ) | 
Creates a new thread executing the specified function.
Threads begin execution immediately upon construction of the associated thread object (pending any OS scheduling delays), starting at the top-level function provided as a constructor argument.
| [in] | function | pointer to the function that should be invoked | 
| [in] | argument | argument that will be passed to the function or NULL | 
| void destroyThread | ( | Thread | thread | ) | 
Destroys thread instance.
| thread | thread instance or NULL | 
| void joinThread | ( | Thread | thread | ) | 
Blocks the current thread until the function execution end.
| thread | thread instance | 
| void sleepThread | ( | double | delay | ) | 
Blocks the execution of the current thread for a specified time.
| delay | thread sleep delay time (in seconds) | 
| bool yieldThread | ( | ) | 
Causes the current thread to yield execution to another thread.
| bool isThreadJoined | ( | Thread | thread | ) | 
Returns thread current join status.
| thread | thread instance | 
| bool isThreadCurrent | ( | Thread | thread | ) | 
Returns true if thread is currently running one.
| thread | thread instance | 
| const void * getThreadNative | ( | Thread | thread | ) | 
Returns pointer to the native thread handle.
| thread | thread instance | 
| bool isThreadMain | ( | Thread | thread | ) | 
Returns true if thread is main.
| thread | target thread instance | 
| void getThreadName | ( | char * | name, | 
| size_t | size ) | 
Returns current thread name.
| [out] | name | pointer to the thread name string | 
| size | maximal name string capacity (including '\0') | 
| void setThreadName | ( | const char * | name | ) | 
Sets current thread name.
| [in] | name | thread name string |