The Object of My Correction ... (Part 2)
pthread_attr_t. The attribute object sets the attributes sp...
The contention scope, scheduling policy and priority of a thread can be set by the attribute object (of my correction) of type
pthread_attr_t. The attribute object sets the attributes specified at the time the thread or group of threads is created.Besides setting the scope, scheduling policy and priority, this object can set:
- size of the thread's stack
- location of the thread's stack
- whether the thread is detached or joinable
pthread_attr_t has several methods to set and retrieve these attributes. The attribute object is first initialized with the default values for all of the individual attributes used by a given implementation. Some implementations do not support the possible values for an attribute. Upon successful completion,
pthread_attr_init ( ) will return a value of
0. If error number is returned this may indicate the value is not supported. For example, for contention scope,
PTHREAD_SCOPE_PROCESS is not supported by the Linux environment. When calling:
int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope);
will return an error code. The table list the default values for Linux and Solaris environment.