thread_pool_control()

Updated: April 19, 2023

Control the thread pool behavior

Synopsis:

#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 )

Arguments:

pool
A thread pool handle that was returned by thread_pool_create().
attr
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 strictly between the range of upper and lower, unless you set THREAD_POOL_CONTROL_NONBLOCK in flags.
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.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

Use thread_pool_control() to specify a thread pool's behavior and adjust its attributes.

Returns:

-1 if an error occurs (errno is set).

Classification:

QNX Neutrino

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes