pthread_set_limit_np() — Set task and thread limits

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both

POSIX(ON)

Format

#define  _OPEN_SYS
#include <pthread.h>

int pthread_set_limit_np(int action, int maxthreadtasks, int maxthreads);

General description

The pthread_set_limit_np() function allows you to control how many tasks and threads can be created for a process. On a single call, you can specify that you want to update either the maximum number of tasks, the maximum number of threads, or both. The maximum number of tasks and threads is dependent upon the size of the private area below 16M. A realistic limit is 200 to 400 tasks and threads.

The action can be set to one of the following symbolics, as defined in the pthread.h header file:
__STL_MAX_TASKS
Specify this action when only updating the maximum number of tasks.
__STL_MAX_THREADS
Specify this action when only updating the maximum number of threads.
__STL_SET_BOTH
Specify this action when updating both the maximum number of tasks and the maximum number of threads at the same time.

For more information on the allowable values for maxthreadtasks and maxthreads, see the BPX1STL function in z/OS UNIX System Services Programming: Assembler Callable Services Reference.

Returned value

If successful, pthread_set_limit_np() returns 0.

If unsuccessful, pthread_set_limit_np() returns -1.

For more information regarding return values and reason codes, see the BPX1STL function in z/OS UNIX System Services Programming: Assembler Callable Services Reference.

Related information