Kohi Game Engine
|
#include "defines.h"
Go to the source code of this file.
Data Structures | |
struct | kthread |
Typedefs | |
typedef struct kthread | kthread |
typedef u32(* | pfn_thread_start) (void *) |
Functions | |
KAPI b8 | kthread_create (pfn_thread_start start_function_ptr, void *params, b8 auto_detach, kthread *out_thread) |
KAPI void | kthread_destroy (kthread *thread) |
KAPI void | kthread_detach (kthread *thread) |
KAPI void | kthread_cancel (kthread *thread) |
KAPI b8 | kthread_is_active (kthread *thread) |
KAPI void | kthread_sleep (kthread *thread, u64 ms) |
KAPI u64 | platform_current_thread_id (void) |
Obtains the identifier for the current thread. More... | |
Represents a process thread in the system to be used for work. Generally should not be created directly in user code. This calls to the platform-specific thread implementation.
typedef u32(* pfn_thread_start) (void *) |
Cancels work on the thread, if possible, and releases resources when possible.
KAPI b8 kthread_create | ( | pfn_thread_start | start_function_ptr, |
void * | params, | ||
b8 | auto_detach, | ||
kthread * | out_thread | ||
) |
Creates a new thread, immediately calling the function pointed to.
start_function_ptr | The pointer to the function to be invoked immediately. Required. |
params | A pointer to any data to be passed to the start_function_ptr. Optional. Pass 0/NULL if not used. |
auto_detach | Indicates if the thread should immediately release its resources when the work is complete. If true, out_thread is not set. |
out_thread | A pointer to hold the created thread, if auto_detach is false. |
Detaches the thread, automatically releasing resources when work is complete.
Indicates if the thread is currently active.
Sleeps on the given thread for a given number of milliseconds. Should be called from the thread requiring the sleep.