Thread pool functions

Updated: May 06, 2022

The library provides the following thread pool functions:

thread_pool_create()
Initializes the pool context. Returns a thread pool handle (tpp) that's used to start the thread pool.
thread_pool_start()
Start the thread pool. This function may or may not return, depending on the flags passed to thread_pool_create().
thread_pool_destroy()
Destroy a thread pool.
thread_pool_control()
Control the number of threads.
Note: In the example provided in the multithreaded resource managers section, thread_pool_start(tpp) never returns because we set the POOL_FLAG_EXIT_SELF bit. Also, the POOL_FLAG_USE_SELF flag itself never returns, but the current thread becomes part of the thread pool.

If no flags are passed (i.e., 0 instead of any flags), the function returns after the thread pool is created.