Control the thread pool behavior
#include <sys/iofunc.h> #include <sys/dispatch.h> thread_pool_control( thread_pool_t * pool, thread_pool_attr_t * attr, uint16_t lower, uint16_t upper, unsigned flags )
- A thread pool handle that was returned by thread_pool_create().
- A pointer to a thread_pool_attr_t structure that specifies the attributes that you want to use for the thread pool. For more information, see " Thread-pool attributes," in the documentation for thread_pool_create().
- lower, upper
- This function blocks until the number of threads created is between the range of upper and lower, unless you set THREAD_POOL_CONTROL_NONBLOCK in flags.
- Which attributes you want to change for the thread pool; any combination
of the following bits:
- THREAD_POOL_CONTROL_HIWATER — adjust the high-water value of the number of threads allowed in the thread pool.
- THREAD_POOL_CONTROL_INCREMENT — adjust the increment value of the number of threads.
- THREAD_POOL_CONTROL_LOWATER — adjust the low-water value of the number of threads allowed in the thread pool.
- THREAD_POOL_CONTROL_MAXIMUM — adjust the maximum value of the number of threads allowed in the thread pool.
- THREAD_POOL_CONTROL_NONBLOCK — don't block while creating threads.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Use thread_pool_control() to specify a thread pool's behavior and adjust its attributes.
Having several threads call this function with the same thread pool handle isn't recommended.
-1 if an error occurs ( errno is set).
Last modified: 2014-11-17