Shadow Network Framework  0.0.2-alpha
C Server Library for Shadow Network Framework
Loading...
Searching...
No Matches
SNF_ThreadPool_t Struct Reference

The structure for a Thread Pool. More...

#include <SNF/thpool.h>

Data Fields

SNF_thpool_workthpool_works
 This LinkedList will store the "works" or "jobs".
 
sem_t thpool_works_sem
 This is the semaphore for handling.
 
SNF_thpool_workerthpool_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(SNF_thpool *pool)
 
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 thpool_n_workers.
 
int thpool_n_workers
 Limiter for the amount of threads that could be created.
 
SNF_thpool_status thpool_status
 If set = 1 the thpool_handler will stop creating "workers" and wait till all already exising "workers" finish their "work".
 
pthread_mutex_t thpool_status_MUTEX
 
pthread_cond_t thpool_status_COND
 
sem_t thpool_status_sem
 

Detailed Description

The structure for a Thread Pool.

Field Documentation

◆ thpool_works

SNF_thpool_work* SNF_ThreadPool_t::thpool_works

This LinkedList will store the "works" or "jobs".

◆ thpool_works_sem

sem_t SNF_ThreadPool_t::thpool_works_sem

This is the semaphore for handling.

◆ thpool_workers

SNF_thpool_worker* SNF_ThreadPool_t::thpool_workers

This LinkedList will store the currently working "workers" or more exactly the worker thread info.

Note
Linked List saves SNF_ThreadPool_work_t . See SNF_ThreadPool_worker_t .

◆ thpool_works_MUTEX

pthread_mutex_t SNF_ThreadPool_t::thpool_works_MUTEX

Used to synchronize the acces to thpool_works.

Warning
Must not be touched or the Thread Pool may not work as intended

◆ thpool_workers_MUTEX

pthread_mutex_t SNF_ThreadPool_t::thpool_workers_MUTEX

Used to synchronize the acces to thpool_workers.

Warning
Must not be touched or the Thread Pool may not work as intended

◆ thpool_noworks_MUTEX

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(SNF_thpool *pool)

Note
Use snf_thpool_wait(SNF_thpool *pool) .

◆ thpool_handler

pthread_t* SNF_ThreadPool_t::thpool_handler

Thread that manages "workers" and assign their "work" to them.

◆ thpool_main_worker

pthread_t* SNF_ThreadPool_t::thpool_main_worker

The main function that is runs first when the Thread pool has started.

◆ thpool_workers_sem

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 thpool_n_workers.

Warning
Must not be touched or the Thread Pool may not work as intended

◆ thpool_n_workers

int SNF_ThreadPool_t::thpool_n_workers

Limiter for the amount of threads that could be created.

Warning
Must not be touched or the Thread Pool may not work as intended

◆ thpool_status

SNF_thpool_status SNF_ThreadPool_t::thpool_status

If set = 1 the thpool_handler will stop creating "workers" and wait till all already exising "workers" finish their "work".

Note
Use snf_thpool_stop(SNF_thpool *pool) .

◆ thpool_status_MUTEX

pthread_mutex_t SNF_ThreadPool_t::thpool_status_MUTEX

◆ thpool_status_COND

pthread_cond_t SNF_ThreadPool_t::thpool_status_COND

◆ thpool_status_sem

sem_t SNF_ThreadPool_t::thpool_status_sem

The documentation for this struct was generated from the following file: