pthread_attr_t

Contains thread attribute information.

Service:Threads

Structure

  #include <pthread.h>
  
  typedef struct
  {
     unsigned long   attr_flags;
     int             attr_scope;
     int             attr_priority;
     int             attr_detachstate;
     void           *attr_stackaddr;
     size_t          attr_stacksize;
     int             attr_policy;
     char            attr_name[20];
  } pthread_attr_t;
  

Fields

attr_flags

Specifies whether the thread can inherit the scheduling policy of the thread that creates it. The following flags have been defined for this field:

Flag

Value

Description

PTHREAD_EXPLICIT_SCHED

0x0002

Indicates that the scheduling policy must be set explicitly for the thread.

PTHREAD_INHERIT_SCHED

0x0004

Unsupported.

attr_scope

Specifies whether threads are scheduled system-wide with the following flags.

Flag

Value

Description

PTHREAD_SCOPE_PROCESS

0

Limits the thread's scope to the process that created it.

PTHREAD_SCOPE_SYSTEM

1

Unsupported.

attr_priority

Specifies the thread's priority. You can set the value, but currently the value has no effect because NetWare runs all threads at the same priority. The default value is 5 (NX_PRIO_MED).

attr_detachstate

Specifies whether the thread can join with other threads with one of the following flags.

Flag

Value

Description

PTHREAD_CREATE_DETACHED

0x00000010

Prevents the thread from join any other threads. It can perform work, but it cannot notify another thread when its work is done.

PTHREAD_CREATE_JOINABLE

0

Allows the thread to join another thread and to notify that thread when it has finished its work. This is the default value.

attr_stackaddr

Points the stack address for the thread.

attr_stacksize

Specifies the stack size for the thread. A value of 0 creates a stack size of 16384 or the value specified at link time.

attr_policy

Specifies the scheduling policy for the thread. For a list of possible values, see Section 55.1.1, Schedule Policies.

attr_name

Specifies the name of the thread. This field is 0 unless a name has been set for the thread with pthread_attr_setname_np.

Remarks

This structure must be initialized with the pthread_attr_init function before it can be used. You should use the pthread_attr_set... functions to modify the default values.