Controls whether a thread is created in a suspended state.
Threads Library (libpthreads.a)
#include <pthread.h> int pthread_attr_setsuspendstate_np(pthread_attr_t, *attr, int suspendstate); int pthread_attr_getsuspendstate_np(pthread_attr_t, *attr, int *suspendstate);
The suspendstate attribute controls whether the thread is created in a suspended state. If the thread is created suspended, the thread start routine will not execute until pthread_continue_np is run on the thread. The pthread_attr_setsuspendstate_np and pthread_attr_getsuspendstate_np routines, respectively, set and get the suspendstate attribute in the attr object.
The suspendstate attribute can be set to either PTHREAD_CREATE_SUSPENDED_NP or PTHREAD_CREATE_UNSUSPENDED_NP. A value of PTHREAD_CREATE_SUSPENDED_NP causes all threads created with attr to be in the suspended state, whereas using a value of PTHREAD_CREATE_UNSUSPENDED_NP causes all threads created with attr to be in the unsuspended state. The default value of the suspendstate attribute is PTHREAD_CREATE_UNSUSPENDED_NP.
attr | Specifies the thread attributes object. |
suspendstate | Points to where the suspendstate attribute value will be stored. |
Upon successful completion, pthread_attr_setsuspendstate_np and pthread_attr_getsuspendstate_np return a value of 0. Otherwise, an error number is returned to indicate the error.
The pthread_attr_getsuspendstate_np function stores the value of the suspendstate attribute in suspendstate if successful.
The pthread_attr_setsuspendstate_np function will fail if:
EINVAL | The value of suspendstate is not valid. |
This subroutine is part of the Base Operating System (BOS) Runtime.