Soletta™ Framework
|
Worker thread functions and context data configuration. More...
#include <sol-worker-thread.h>
Data Fields | |
uint16_t | api_version |
must match SOL_WORKER_THREAD_CONFIG_API_VERSION in runtime More... | |
void(* | cancel )(void *data) |
function to be called from the main thread before the worker thread is to be terminated. More... | |
void(* | cleanup )(void *data) |
function to be called once from the worker thread, after all other thread functions. More... | |
const void * | data |
the context data to give to all functions. More... | |
void(* | feedback )(void *data) |
function to be called from the main thread after the worker thread calls sol_worker_thread_feedback(). More... | |
void(* | finished )(void *data) |
function to be called from the main thread after the worker thread is finished. More... | |
bool(* | iterate )(void *data) |
function to be called repeatedly from the worker thread until it returns false or sol_worker_thread_cancel() is called from the main thread. More... | |
bool(* | setup )(void *data) |
function to be called once from the worker thread, before all other thread functions. More... | |
Worker thread functions and context data configuration.
uint16_t sol_worker_thread_config::api_version |
must match SOL_WORKER_THREAD_CONFIG_API_VERSION in runtime
void(* sol_worker_thread_config::cancel)(void *data) |
function to be called from the main thread before the worker thread is to be terminated.
There is no locking, then if you touch sensitive resources shared with the thread be sure to handle locking to avoid race-conditions – both setup, iterate or cleanup may be in executing when this function is called! May be NULL
if nothing is to be done.
void(* sol_worker_thread_config::cleanup)(void *data) |
function to be called once from the worker thread, after all other thread functions.
It's always called if sol_worker_thread_new() returns non-NULL. If the setup function returns false, then this function will not be called! May be NULL
if nothing is to be done.
const void* sol_worker_thread_config::data |
the context data to give to all functions.
void(* sol_worker_thread_config::feedback)(void *data) |
function to be called from the main thread after the worker thread calls sol_worker_thread_feedback().
May be NULL
if nothing is to be done.
void(* sol_worker_thread_config::finished)(void *data) |
function to be called from the main thread after the worker thread is finished.
After this function is called the pointer to the worker thread is freed and should be considered invalid. This function is called both when the work is finished (iterate returns false) and when the thread is cancelled with sol_worker_thread_cancel()). May be NULL
if nothing is to be done.
bool(* sol_worker_thread_config::iterate)(void *data) |
function to be called repeatedly from the worker thread until it returns false or sol_worker_thread_cancel() is called from the main thread.
If the setup function returns false, then this function will not be called! This function must not be NULL
.
bool(* sol_worker_thread_config::setup)(void *data) |
function to be called once from the worker thread, before all other thread functions.
It's always called if sol_worker_thread_new() returns non-NULL. If the setup function returns false then the thread is terminated and no further functions will be called from the thread – that is, only the finished may be called. May be NULL
if nothing is to be done.