Shadow Network Framework
0.0.1-alpha
C Server Library for Shadow Network Framework
|
The structure for a Thread Pool. More...
#include <SNF/thpool.h>
Data Fields | |
SNF_thpool_work * | thpool_works |
This LinkedList will store the "works" or "jobs". | |
_Atomic int | thpool_n_works |
Defines current amount of currently awaiting "works". | |
SNF_thpool_worker * | thpool_workers |
This LinkedList will store the currently working "workers" or more exactly the worker thread info. | |
pthread_mutex_t | thpool_works_MUTEX |
Used to synchronize the acces to thpool_works. | |
pthread_mutex_t | thpool_workers_MUTEX |
Used to synchronize the acces to thpool_workers. | |
pthread_mutex_t | thpool_noworks_MUTEX |
Used to synchronize if all "works" are handled and all "workers" had finished their assigned "work" See snf_thpool_wait(thpool *pool) | |
pthread_cond_t | thpool_noworks_cond |
Used to synchronize if all "works" are handled and all "workers" had finished their assigned "work" See snf_thpool_wait(thpool *pool) | |
pthread_cond_t | thpool_works_cond |
Used to synchronize the acces to thpool_works. | |
pthread_t * | thpool_handler |
Thread that manages "workers" and assign their "work" to them. | |
pthread_t * | thpool_main_worker |
The main function that is runs first when the Thread pool has started. | |
sem_t | thpool_workers_sem |
Semaphore used for synchronization; Used primarly to notify the conclusion of "workers" to the Thread pool handler, and to Limit the amount of "worker" threads with the max being max_workers_count. | |
int | max_workers_count |
Limiter for the amount of threads that could be created. | |
_Atomic int | stop |
If set = 1 the thpool_handler will stop creating "workers" and wait till all already exising "workers" finish their "work". | |
The structure for a Thread Pool.
SNF_thpool_work* SNF_ThreadPool_t::thpool_works |
This LinkedList will store the "works" or "jobs".
_Atomic int SNF_ThreadPool_t::thpool_n_works |
Defines current amount of currently awaiting "works".
SNF_thpool_worker* SNF_ThreadPool_t::thpool_workers |
This LinkedList will store the currently working "workers" or more exactly the worker thread info.
pthread_mutex_t SNF_ThreadPool_t::thpool_works_MUTEX |
Used to synchronize the acces to thpool_works.
pthread_mutex_t SNF_ThreadPool_t::thpool_workers_MUTEX |
Used to synchronize the acces to thpool_workers.
pthread_mutex_t SNF_ThreadPool_t::thpool_noworks_MUTEX |
Used to synchronize if all "works" are handled and all "workers" had finished their assigned "work" See snf_thpool_wait(thpool *pool)
pthread_cond_t SNF_ThreadPool_t::thpool_noworks_cond |
Used to synchronize if all "works" are handled and all "workers" had finished their assigned "work" See snf_thpool_wait(thpool *pool)
pthread_cond_t SNF_ThreadPool_t::thpool_works_cond |
Used to synchronize the acces to thpool_works.
pthread_t* SNF_ThreadPool_t::thpool_handler |
Thread that manages "workers" and assign their "work" to them.
pthread_t* SNF_ThreadPool_t::thpool_main_worker |
The main function that is runs first when the Thread pool has started.
sem_t SNF_ThreadPool_t::thpool_workers_sem |
Semaphore used for synchronization; Used primarly to notify the conclusion of "workers" to the Thread pool handler, and to Limit the amount of "worker" threads with the max being max_workers_count.
int SNF_ThreadPool_t::max_workers_count |
Limiter for the amount of threads that could be created.
_Atomic int SNF_ThreadPool_t::stop |
If set = 1 the thpool_handler will stop creating "workers" and wait till all already exising "workers" finish their "work".