[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    thr_setconcurrency(3T) manual page Table of Contents

Name

thr_setconcurrency, thr_getconcurrency - get/set thread concurrency level

Synopsis

#include <thread.h>

int thr_setconcurrency(int new_level);

int thr_getconcurrency(void );

MT-Level

MT-Safe

Description

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.

Return Values

thr_setconcurrency() returns zero when successful. A non-zero value indicates an error code.

thr_getconcurrency() always returns the current value for the desired concurrency level.

Errors

If any of the following conditions are detected, thr_setconcurrency() fails and returns the corresponding value:

EAGAIN
the specified concurrency level would cause a system resource to be exceeded.
EINVAL
new_level is negative.

See Also

thr_create(3T) .

Notes

The Solaris threads set/get concurrency functionality described on this man page are not implemented in the POSIX threads interface.


Table of Contents