Supports the creation and destruction of threads.
More...
#include <kinc/global.h>
#include <kinc/backend/thread.h>
Go to the source code of this file.
|
|
KINC_FUNC void | kinc_threads_init (void) |
| | Initializes the threading system. This has to be called before calling any kinc_thread functions.
|
| KINC_FUNC void | kinc_threads_quit (void) |
| | Shuts down the threading system.
|
| KINC_FUNC void | kinc_thread_init (kinc_thread_t *thread, void(*func)(void *param), void *param) |
| | Starts a thread via the provided function.
|
| KINC_FUNC void | kinc_thread_wait_and_destroy (kinc_thread_t *thread) |
| | Waits for the thread to complete execution and then destroys it.
|
| KINC_FUNC bool | kinc_thread_try_to_destroy (kinc_thread_t *thread) |
| | Attempts to destroy a thread.
|
| KINC_FUNC void | kinc_thread_set_name (const char *name) |
| | Assigns a name to the current thread which will then show up in debuggers and profilers.
|
| KINC_FUNC void | kinc_thread_sleep (int milliseconds) |
| | Puts the current thread to sleep.
|
Supports the creation and destruction of threads.
◆ kinc_thread_init()
| KINC_FUNC void kinc_thread_init |
( |
kinc_thread_t * | thread, |
|
|
void(* | func )(void *param), |
|
|
void * | param ) |
Starts a thread via the provided function.
- Parameters
-
| thread | The thread-object to initialize with the new thread |
| func | The function used to start a new thread |
| param | A parameter that is passed to the thread-function when the thread starts running |
◆ kinc_thread_set_name()
| KINC_FUNC void kinc_thread_set_name |
( |
const char * | name | ) |
|
Assigns a name to the current thread which will then show up in debuggers and profilers.
- Parameters
-
| name | The name to assign to the thread |
◆ kinc_thread_sleep()
| KINC_FUNC void kinc_thread_sleep |
( |
int | milliseconds | ) |
|
Puts the current thread to sleep.
- Parameters
-
| milliseconds | How long to sleep |
◆ kinc_thread_try_to_destroy()
| KINC_FUNC bool kinc_thread_try_to_destroy |
( |
kinc_thread_t * | thread | ) |
|
Attempts to destroy a thread.
- Parameters
-
| thread | The thread to destroy |
- Returns
- Returns if the thread is still running and therefore couldn't be destroyed
◆ kinc_thread_wait_and_destroy()
| KINC_FUNC void kinc_thread_wait_and_destroy |
( |
kinc_thread_t * | thread | ) |
|
Waits for the thread to complete execution and then destroys it.
- Parameters
-
| thread | The thread to destroy |
◆ kinc_threads_quit()
| KINC_FUNC void kinc_threads_quit |
( |
void | | ) |
|
Shuts down the threading system.
- Returns