#include <thread.h>
int thr_setconcurrency(int new_level);
int thr_getconcurrency(void );
MT-Safe
Unbound threads in a process (see thr_create(3T) ) may or may not be required to be simultaneously active. By default, the threads system ensures that a sufficient number of threads are active so that the process can continue to make progress. While this conserves system resources, it may not produce the most effective level of concurrency. thr_setconcurrency() permits the application to give the threads system a hint, specified by new_level, for the desired level of concurrency. The actual number of simultaneously active threads may be larger or smaller than this number. The value for the desired concurrency level may also be affected by creating threads with the THR_NEW_LWP flag set (see thr_create(3T) ).
If new_level is zero, the threads system will only ensure that a sufficient number of threads are active so that the process can continue to make progress.
thr_getconcurrency() returns the current value for the desired concurrency level. The actual number of simultaneously active threads may be larger or smaller than this number.
thr_getconcurrency() always returns the current value for the desired concurrency level.
If any of the following conditions are detected, thr_setconcurrency() fails and returns the corresponding value: