Nilorea Library
C utilities for networking, threading, graphics
|
Thread pool functions. More...
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include "nilorea/n_thread_pool.h"
#include "nilorea/n_time.h"
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <errno.h>
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 More... | |
int | destroy_threaded_pool (THREAD_POOL **pool, int delay) |
delete a thread_pool, exit the threads and free the structs More... | |
int | get_nb_cpu_cores () |
get number of core of current system More... | |
THREAD_POOL * | new_thread_pool (int nbmaxthr, int nb_max_waiting) |
Create a new pool of nbmaxthr threads. More... | |
int | refresh_thread_pool (THREAD_POOL *thread_pool) |
try to add some waiting DIRECT_PROCs on some free thread slots, else do nothing More... | |
int | start_threaded_pool (THREAD_POOL *thread_pool) |
Launch the process waiting for exectution in the thread pool. More... | |
void * | thread_pool_processing_function (void *param) |
Internal thread pool processing function. More... | |
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 More... | |
int | wait_for_threaded_pool (THREAD_POOL *thread_pool, int delay) |
Wait for all the launched process in the thread pool to terminate. More... | |
void * thread_pool_processing_function | ( | void * | param | ) |
Internal thread pool processing function.
param | Teh eventual param of a process |
Definition at line 47 of file n_thread_pool.c.
References EXITED_THREAD, EXITING_THREAD, IDLE_PROC, LOG_DEBUG, LOG_ERR, n_log, refresh_thread_pool(), RUNNING_PROC, RUNNING_THREAD, and SYNCED_PROC.
Referenced by new_thread_pool().