dg_pthread_attr_setgroup(3T) DG/UX R4.11MU05 dg_pthread_attr_setgroup(3T)
NAME
dgpthreadattrsetgroup, dgpthreadattrgetgroup - manipulate a
thread's group attribute
SYNOPSIS
#include <pthread.h>
int dgpthreadattrsetgroup(dgpthreadattrt *attr,
dgpthreadgroupt threadgroup);
int dgpthreadattrgetgroup(dgpthreadattrt *attr,
dgpthreadgroupt *threadgroup);
where:
attr A pointer to a thread attributes object, which should
have been initialized by a previous call to
dgpthreadattrinit().
threadgroup
For dgpthreadattrsetgroup(), the thread group
attribute. For dgpthreadattrgetgroup(), a pointer to
a location to receive the thread group attribute.
DESCRIPTION
The threadgroup attribute specifies the thread group in which
threads are created when the thread attributes object pointed to by
attr is used in calls to pthreadcreate(). Thread groups are created
with calls to dgpthreadgroupcreate().
The default threadgroup attribute value is DGPTHREADDEFAULTGROUP.
The meaning of this default value depends on the contention scopes of
the creator and the new thread. If the new thread is created with
global contention scope, it is created in a dedicated thread group.
For threads created with global contention scope,
PTHREADDEFAULTGROUP is the only allowed value for the threadgroup
attribute. For threads created with local contention scope, the
thread group depends on the contention scope of the creating thread.
If the creating thread has local contention scope, the new thread
will be created in the same thread group; otherwise if the creating
thread has global contention scope, the new thread will be created in
the process's initial thread group, which is guaranteed to exist.
If a value other than DGPTHREADDEFAULTGROUP is specified for the
threadgroup attribute, threads will be created in the thread group
with the given thread group ID. Such threads must have local
contention scope, otherwise pthreadcreate() will fail with EINVAL.
If threadgroup denotes the ID of a non-existent thread group or a
thread group that has been marked for destruction, pthreadcreate()
will fail with ESRCH.
DIAGNOSTICS
Returns
If successful, dgpthreadattrsetgroup() returns 0. Otherwise it
returns -1 and sets errno to indicate the error.
If successful, dgpthreadattrgetgroup() returns 0 and stores the
thread group attribute in the location pointed to by threadgroup.
Otherwise it returns -1 and sets errno to indicate the error.
Errors
For each of the following conditions, dgpthreadattrsetgroup() and
dgpthreadattrgetgroup() return -1 and set errno to the
corresponding value:
[EINVAL] An invalid attributes object has been specified. This
occurs when DG/UX has detected that the attributes object
pointed to by attr has not been initialized by a previous
call to pthreadattrinit() or has been corrupted.
SEE ALSO
pthreadattrinit(3T), pthreadattrdestroy(3T),
pthreadattrsetscope(3T), dgpthreadgroupcreate(3T),
dgpthreadgroupdestroy(3T), dgpthreadgroupself(3T),
dgpthreadgroupequal(3T), pthreadcreate(3T).
NOTES
The validity of the threadgroup attribute is not checked until the
attributes object is used in a call to pthreadcreate().
The threadgroup attribute cannot be changed for an existing thread.
Once a thread is created in a thread group, its thread group
assignment may not be changed. Moreover, pthreadgetschedattr() does
not return the threadgroup of the target thread, nor does
pthreadsetschedattr() attempt to change it.
Licensed material--property of copyright holder(s)