Kore 3
Loading...
Searching...
No Matches
thread.h File Reference

Supports the creation and destruction of threads. More...

#include <kore3/global.h>
#include <kore3/backend/thread.h>

Go to the source code of this file.

Data Structures

struct  kore_thread

Typedefs

typedef struct kore_thread kore_thread

Functions

KORE_FUNC void kore_thread_init (kore_thread *thread, void(*func)(void *param), void *param)
 Starts a thread via the provided function.
KORE_FUNC void kore_thread_wait_and_destroy (kore_thread *thread)
 Waits for the thread to complete execution and then destroys it.
KORE_FUNC bool kore_thread_try_to_destroy (kore_thread *thread)
 Attempts to destroy a thread.
KORE_FUNC void kore_thread_set_name (const char *name)
 Assigns a name to the current thread which will then show up in debuggers and profilers.
KORE_FUNC void kore_thread_sleep (int milliseconds)
 Puts the current thread to sleep.

Detailed Description

Supports the creation and destruction of threads.

Function Documentation

◆ kore_thread_init()

KORE_FUNC void kore_thread_init ( kore_thread * thread,
void(* func )(void *param),
void * param )

Starts a thread via the provided function.

Parameters
threadThe thread-object to initialize with the new thread
funcThe function used to start a new thread
paramA parameter that is passed to the thread-function when the thread starts running

◆ kore_thread_set_name()

KORE_FUNC void kore_thread_set_name ( const char * name)

Assigns a name to the current thread which will then show up in debuggers and profilers.

Parameters
nameThe name to assign to the thread

◆ kore_thread_sleep()

KORE_FUNC void kore_thread_sleep ( int milliseconds)

Puts the current thread to sleep.

Parameters
millisecondsHow long to sleep

◆ kore_thread_try_to_destroy()

KORE_FUNC bool kore_thread_try_to_destroy ( kore_thread * thread)

Attempts to destroy a thread.

Parameters
threadThe thread to destroy
Returns
Returns if the thread is still running and therefore couldn't be destroyed

◆ kore_thread_wait_and_destroy()

KORE_FUNC void kore_thread_wait_and_destroy ( kore_thread * thread)

Waits for the thread to complete execution and then destroys it.

Parameters
threadThe thread to destroy