Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Functions | |
static RZ_TH_RET_T | thread_main_function (void *_th) |
RZ_IPI RZ_TH_TID | rz_th_self (void) |
RZ_API bool | rz_th_set_name (RZ_NONNULL RzThread *th, RZ_NONNULL const char *name) |
Sets the name of the thread. More... | |
RZ_API bool | rz_th_get_name (RZ_NONNULL RzThread *th, RZ_NONNULL RZ_OUT char *name, size_t len) |
Gets the name of the thread and writes it into the output buffer. More... | |
RZ_API bool | rz_th_set_affinity (RZ_NONNULL RzThread *th, int cpuid) |
Sets the thread cpu affinity. More... | |
RZ_API RZ_OWN RzThread * | rz_th_new (RZ_NONNULL RzThreadFunction function, RZ_NULLABLE void *user) |
Creates and starts a new thread. More... | |
RZ_API bool | rz_th_wait (RZ_NONNULL RzThread *th) |
Awaits indefinetely for a thread to join. More... | |
RZ_API void | rz_th_free (RZ_NULLABLE RzThread *th) |
Frees a RzThread structure. More... | |
RZ_API RZ_OWN void * | rz_th_get_user (RZ_NONNULL RzThread *th) |
Returns user pointer of thread. More... | |
RZ_API RZ_OWN void * | rz_th_get_retv (RZ_NONNULL RzThread *th) |
Returns return value of the thread. More... | |
RZ_API bool | rz_th_yield (void) |
Yield the processor. More... | |
RZ_API void rz_th_free | ( | RZ_NULLABLE RzThread * | th | ) |
Frees a RzThread structure.
th | The RzThread to free |
Definition at line 246 of file thread.c.
References free().
Referenced by create_string_search_thread(), create_thread_interval(), rz_basefind(), rz_subprocess_fini(), rz_test_main(), rz_th_pool_free(), and task_free().
RZ_API bool rz_th_get_name | ( | RZ_NONNULL RzThread * | th, |
RZ_NONNULL RZ_OUT char * | name, | ||
size_t | len | ||
) |
Gets the name of the thread and writes it into the output buffer.
th | The thread from which the name is taken |
name | The output buffer name to use to copy the name |
len | The output buffer length |
Definition at line 86 of file thread.c.
References len, name::name, RZ_LOG_ERROR, rz_return_val_if_fail, and rz_str_ncpy().
RZ_API RZ_OWN void* rz_th_get_retv | ( | RZ_NONNULL RzThread * | th | ) |
Returns return value of the thread.
th | The thread to get the return value from |
Definition at line 275 of file thread.c.
References NULL, and rz_return_val_if_fail.
RZ_API RZ_OWN void* rz_th_get_user | ( | RZ_NONNULL RzThread * | th | ) |
Returns user pointer of thread.
th | The thread to get the user pointer from |
Definition at line 263 of file thread.c.
References NULL, and rz_return_val_if_fail.
Referenced by basefind_stop_all_search_threads(), basefind_thread_ui(), interrupt_thread(), rz_basefind(), rz_bin_file_strings(), and rz_core_wait().
RZ_API RZ_OWN RzThread* rz_th_new | ( | RZ_NONNULL RzThreadFunction | function, |
RZ_NULLABLE void * | user | ||
) |
Creates and starts a new thread.
function | The callback to call when the thread starts. |
user | A pointer to a user structure to pass to the callback function |
Definition at line 198 of file thread.c.
References free(), rz_th_t::function, NULL, RZ_LOG_ERROR, RZ_NEW0, rz_return_val_if_fail, thread_main_function(), rz_th_t::tid, and rz_th_t::user.
Referenced by create_string_search_thread(), create_thread_interval(), rz_basefind(), rz_core_rtr_cmd(), rz_core_task_enqueue(), rz_run_config_env(), rz_subprocess_init(), and rz_test_main().
RZ_IPI RZ_TH_TID rz_th_self | ( | void | ) |
RZ_API bool rz_th_set_affinity | ( | RZ_NONNULL RzThread * | th, |
int | cpuid | ||
) |
Sets the thread cpu affinity.
th | The thread to change the cpu affinity |
cpuid | The cpuid to set to the thread. |
Definition at line 122 of file thread.c.
References c, NULL, RZ_LOG_ERROR, rz_return_val_if_fail, and ut64().
Referenced by rz_core_rtr_cmd().
RZ_API bool rz_th_set_name | ( | RZ_NONNULL RzThread * | th, |
RZ_NONNULL const char * | name | ||
) |
Sets the name of the thread.
th | The thread to rename |
name | The name to assign to the thread |
Definition at line 44 of file thread.c.
References RZ_LOG_ERROR, and rz_return_val_if_fail.
Referenced by rz_core_rtr_cmd().
RZ_API bool rz_th_wait | ( | RZ_NONNULL RzThread * | th | ) |
Awaits indefinetely for a thread to join.
[in] | th | The thread to await for. |
Definition at line 231 of file thread.c.
References NULL, and rz_return_val_if_fail.
Referenced by interrupt_thread(), rz_basefind(), rz_core_wait(), rz_subprocess_fini(), rz_test_main(), rz_th_pool_wait(), and task_free().
Yield the processor.
Definition at line 285 of file thread.c.
References rz_sys_usleep().
|
static |
Definition at line 13 of file thread.c.
References rz_th_t::function, NULL, rz_th_t::retv, and rz_th_t::user.
Referenced by rz_th_new().