Standard C Library Functions pthreadgetconcurrency(3C)
NAME
pthreadgetconcurrency, pthreadsetconcurrency - get or set
level of concurrency
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include
int pthreadgetconcurrency(void);
int pthreadsetconcurrency(int newlevel);
DESCRIPTION
Unbound threads in a process may or may not be required to
be simultaneously active. By default, the threads implemen-
tation 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.
The pthreadsetconcurrency() function allows an application
to inform the threads implementation of its desired con-
currency level, newlevel. The actual level of concurrency
provided by the implementation as a result of this function
call is unspecified.
If newlevel is 0, it causes the implementation to maintain
the concurrency level at its discretion as if
pthreadsetconcurrency() was never called.
The pthreadgetconcurrency() function returns the value
set by a previous call to the pthreadsetconcurrency()
function. If the pthreadsetconcurrency() function was not
previously called, this function returns 0 to indicate that
the implementation is maintaining the concurrency level.
When an application calls pthreadsetconcurrency() it is
informing the implementation of its desired concurrency
level. The implementation uses this as a hint, not a
requirement.
If an implementation does not support multiplexing of user
threads on top of several kernel scheduled entities, the
pthreadsetconcurrency() and pthreadgetconcurrency() func-
tions will be provided for source code compatibility but
SunOS 5.11 Last change: 23 Mar 2005 1
Standard C Library Functions pthreadgetconcurrency(3C)
they will have no effect when called. To maintain the func-
tion semantics, the newlevel parameter will be saved when
pthreadsetconcurrency() is called so that a subsequent call
to pthreadgetconcurrency() returns the same value.
RETURN VALUES
If successful, the pthreadsetconcurrency() function
returns 0. Otherwise, an error number is returned to indi-
cate the error.
The pthreadgetconcurrency() function always returns the
concurrency level set by a previous call to
pthreadsetconcurrency(). If the pthreadsetconcurrency()
function has never been called, pthreadgetconcurrency()
returns 0.
ERORS
The pthreadsetconcurrency() function will fail if:
EINVAL The value specified by newlevel is negative.
EAGAIN The value specific by newlevel would cause a sys-
tem resource to be exceeded.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
MT-Level MT-Safe
SEE ALSO
pthreadcreate(3C), pthreadattrinit(3C), attributes(5),
standards(5)
SunOS 5.11 Last change: 23 Mar 2005 2
|