pthread_attr_init

Initializes a thread attribute object.

Library:LibC
Classification:POSIX
Service:Threads

Syntax

  #include <pthread.h>
   
  int   pthread_attr_init   (
     pthread_attr_t   *attr);
  

Parameters

attr

(IN) Points to the attribute structure to initialize.

Return Values

Returns zero. No error conditions have been defined.

Remarks

The pthread_attr_init function initializes the thread attributes to the following values:

  • Scope to PTHREAD_SCOPE_PROCESS. Other values for this attribute are not currently supported on NetWare.

  • Priority to medium. Although this attribute is supported, it has no effect because NetWare runs all threads at the same priority.

  • Detached state to joinable. You can use the pthread_attr_setdetachstate to set the state to either PTHREAD_CREATE_JOINABLE or PTHREAD_CREATE_DETACHED.

  • Stack address to a NULL pointer. The NetWare operating system selects the address when the thread is created. To specify your own address, use the pthread_attr_setstackaddr function. After the thread is created, you can use the pthread_attr_getstackaddr function to obtain the address.

  • Stack size to PTHREAD_STACK_MIN which gives the thread a default stack size of 16384 or the value specified at link time.You can use the pthread_attr_setstacksize function to change this initial size before the thread is created. Once the thread is created, you cannot change its stack size.

  • Policy to SCHED_FIFO. Other values for this attribute are not currently supported on NetWare.

These attributes can be modified by calling the specialized attribute functions such as pthread_attr_setscope, pthread_attr_setstackaddr, etc.

See Also