Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | rz_th_pool_t |
RzThreadPool is a structure which handles n-threads threads. More... | |
Functions | |
RZ_API size_t | rz_th_physical_core_number () |
Returns the number of available physical cores of the host machine. More... | |
RZ_API size_t | rz_th_request_physical_cores (size_t max_cores) |
Returns the maximum number of cores available regardless of the number of cores requested. When set to 0, it will be the max number of physical cores. More... | |
RZ_API RZ_OWN RzThreadPool * | rz_th_pool_new (size_t max_threads) |
returns a new RzThreadPool structure with a pool of thread More... | |
RZ_API void | rz_th_pool_free (RZ_NULLABLE RzThreadPool *pool) |
Kills (and frees) the threads and frees the RzThreadPool struct. More... | |
RZ_API bool | rz_th_pool_add_thread (RZ_NONNULL RzThreadPool *pool, RZ_NONNULL RzThread *thread) |
Adds a thread to the thread pool. More... | |
RZ_API RZ_BORROW RzThread * | rz_th_pool_get_thread (RZ_NONNULL RzThreadPool *pool, size_t index) |
Returns the n-th thread in the thread pool. More... | |
RZ_API bool | rz_th_pool_wait (RZ_NONNULL RzThreadPool *pool) |
Waits the end of all the threads in the thread pool. More... | |
RZ_API size_t | rz_th_pool_size (RZ_NONNULL RzThreadPool *pool) |
Returns the thread pool size. More... | |
Returns the number of available physical cores of the host machine.
Definition at line 22 of file thread_pool.c.
References info(), NULL, sysinfo, and UT32_MAX.
Referenced by rz_th_request_physical_cores().
RZ_API bool rz_th_pool_add_thread | ( | RZ_NONNULL RzThreadPool * | pool, |
RZ_NONNULL RzThread * | thread | ||
) |
Adds a thread to the thread pool.
RzThreadPool | The thread pool where to add the thread |
RzThread | The thread to add to the pool |
Definition at line 138 of file thread_pool.c.
References i, RZ_LOG_DEBUG, and rz_return_val_if_fail.
Referenced by create_string_search_thread(), and create_thread_interval().
RZ_API void rz_th_pool_free | ( | RZ_NULLABLE RzThreadPool * | pool | ) |
Kills (and frees) the threads and frees the RzThreadPool struct.
RzThreadPool | *The thread pool to free |
Definition at line 117 of file thread_pool.c.
References free(), i, NULL, and rz_th_free().
Referenced by rz_basefind(), and rz_bin_file_strings().
RZ_API RZ_BORROW RzThread* rz_th_pool_get_thread | ( | RZ_NONNULL RzThreadPool * | pool, |
size_t | index | ||
) |
Returns the n-th thread in the thread pool.
pool | The thread pool to use |
index | The index of the thread to get |
Definition at line 158 of file thread_pool.c.
References NULL, and rz_return_val_if_fail.
Referenced by basefind_stop_all_search_threads(), basefind_thread_ui(), interrupt_pool(), rz_basefind(), and rz_bin_file_strings().
RZ_API RZ_OWN RzThreadPool* rz_th_pool_new | ( | size_t | max_threads | ) |
returns a new RzThreadPool structure with a pool of thread
Returns a new RzThreadPool structure with a pool of thread limited by either the physical core number count or by the value specified by the user (if set to 0, it will be the max physical cores number)
max_threads | The maximum number of threads needed in the pool |
Definition at line 96 of file thread_pool.c.
References free(), NULL, RZ_NEW0, RZ_NEWS0, rz_th_request_physical_cores(), rz_th_pool_t::size, and rz_th_pool_t::threads.
Referenced by rz_basefind(), and rz_bin_file_strings().
RZ_API size_t rz_th_pool_size | ( | RZ_NONNULL RzThreadPool * | pool | ) |
Returns the thread pool size.
pool | The RzThreadPool to use |
Definition at line 189 of file thread_pool.c.
References rz_return_val_if_fail.
Referenced by basefind_stop_all_search_threads(), basefind_thread_ui(), interrupt_pool(), rz_basefind(), and rz_bin_file_strings().
RZ_API bool rz_th_pool_wait | ( | RZ_NONNULL RzThreadPool * | pool | ) |
Waits the end of all the threads in the thread pool.
RzThreadPool | The thread pool to wait for |
Definition at line 170 of file thread_pool.c.
References i, RZ_LOG_DEBUG, rz_return_val_if_fail, and rz_th_wait().
Referenced by rz_basefind(), and rz_bin_file_strings().
Returns the maximum number of cores available regardless of the number of cores requested. When set to 0, it will be the max number of physical cores.
[in] | max_cores | The maximum number of physical cores to request |
Definition at line 78 of file thread_pool.c.
References RZ_MIN, and rz_th_physical_core_number().
Referenced by rz_core_bin_basefind_print(), and rz_th_pool_new().