![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Thread pool functions. More...
#include <unistd.h>#include "nilorea/n_common.h"#include "nilorea/n_log.h"#include "nilorea/n_thread_pool.h"#include "nilorea/n_time.h"#include <pthread.h>#include <string.h>#include <errno.h>
Include dependency graph for n_thread_pool.c:Go to the source code of this file.
Functions | |
| int | add_threaded_process (THREAD_POOL *thread_pool, void *(*func_ptr)(void *param), void *param, int mode) |
| add a function and params to a thread pool | |
| int | destroy_threaded_pool (THREAD_POOL **pool, unsigned int delay) |
| delete a thread_pool, exit the threads and free the structs | |
| long int | get_nb_cpu_cores () |
| get number of core of current system | |
| THREAD_POOL * | new_thread_pool (size_t nbmaxthr, size_t nb_max_waiting) |
| Create a new pool of nbmaxthr threads. | |
| int | refresh_thread_pool (THREAD_POOL *thread_pool) |
| try to add some waiting DIRECT_PROCs on some free thread slots, else do nothing | |
| int | start_threaded_pool (THREAD_POOL *thread_pool) |
| Launch the process waiting for execution in the thread pool. | |
| void * | thread_pool_processing_function (void *param) |
| Internal thread pool processing function. | |
| int | wait_for_synced_threaded_pool (THREAD_POOL *thread_pool) |
| wait for all the launched process, blocking but light on the CPU as there is no polling | |
| int | wait_for_threaded_pool (THREAD_POOL *thread_pool, unsigned int delay) |
| Wait for all the launched process in the thread pool to terminate. | |
| void * thread_pool_processing_function | ( | void * | param | ) |
Internal thread pool processing function.
| param | params of a threaded process |
Definition at line 43 of file n_thread_pool.c.
References EXITED_THREAD, EXITING_THREAD, THREAD_POOL_NODE::func, IDLE_PROC, THREAD_POOL_NODE::lock, LOG_DEBUG, LOG_ERR, LOG_INFO, n_log, THREAD_POOL_NODE::param, refresh_thread_pool(), RUNNING_PROC, RUNNING_THREAD, THREAD_POOL_NODE::state, SYNCED_PROC, THREAD_POOL_NODE::th_end, THREAD_POOL_NODE::th_start, THREAD_POOL_NODE::thr, THREAD_POOL_NODE::thread_pool, THREAD_POOL_NODE::thread_state, and THREAD_POOL_NODE::type.
Referenced by new_thread_pool().
Here is the call graph for this function:
Here is the caller graph for this function: