Shadow Network Framework
0.0.2-alpha
C Server Library for Shadow Network Framework
|
"In computer programming, a thread pool is a software design pattern for achieving concurrency of execution in a computer program. ... a thread pool maintains multiple threads waiting for tasks to be allocated for concurrent execution by the supervising program. By maintaining a pool of threads, the model increases performance and avoids latency in execution due to frequent creation and destruction of threads for short-lived tasks" (Source)
Please note that this implementation of thread pools that I made from the ground up so it is ground to have bugs or issues, if you incounter any one of these issues please report them at the Github repository.
First of all you need to add the Following header to make use of the thread pool
For Initializing we require 4 parameters
once we have prepared all those parameters we call the function snf_thpool_inis Everything will be started directly after initializing. Example Code:
as of 0.0.2-alpha youare able to stop the Thread Pool and close the threads running in the background then Run it again by recreating the threads according to configuration. Note however it does not affect the Main_Worker
To check if the ThreadPool you must see the ThreadPool->thpool_status
and what it equates to from one of the statuses stated in SNF_thpool_status