24 #include "sol-common-buildopts.h"
55 #ifndef SOL_NO_API_VERSION
56 #define SOL_WORKER_THREAD_CONFIG_API_VERSION (1)
struct sol_worker_thread * sol_worker_thread_new(const struct sol_worker_thread_config *config)
Create and run a worker thread.
bool(* iterate)(void *data)
function to be called repeatedly from the worker thread until it returns false or sol_worker_thread_c...
Definition: sol-worker-thread.h:84
void(* finished)(void *data)
function to be called from the main thread after the worker thread is finished.
Definition: sol-worker-thread.h:102
void(* feedback)(void *data)
function to be called from the main thread after the worker thread calls sol_worker_thread_feedback()...
Definition: sol-worker-thread.h:108
bool(* setup)(void *data)
function to be called once from the worker thread, before all other thread functions.
Definition: sol-worker-thread.h:70
const void * data
the context data to give to all functions.
Definition: sol-worker-thread.h:61
struct sol_worker_thread sol_worker_thread
A worker thread handle.
Definition: sol-worker-thread.h:49
Worker thread functions and context data configuration.
Definition: sol-worker-thread.h:54
uint16_t api_version
must match SOL_WORKER_THREAD_CONFIG_API_VERSION in runtime
Definition: sol-worker-thread.h:58
void(* cancel)(void *data)
function to be called from the main thread before the worker thread is to be terminated.
Definition: sol-worker-thread.h:93
void(* cleanup)(void *data)
function to be called once from the worker thread, after all other thread functions.
Definition: sol-worker-thread.h:77
struct sol_worker_thread_config sol_worker_thread_config
Worker thread functions and context data configuration.
bool sol_worker_thread_is_cancelled(const struct sol_worker_thread *thread)
Check if a worker thread has been marked as cancelled.
void sol_worker_thread_cancel(struct sol_worker_thread *thread)
Cancel a worker thread.
void sol_worker_thread_feedback(struct sol_worker_thread *thread)
Schedule feedback from the worker to the main thread.