pthread_attr_getsuspendstate_np()

Get the thread suspend state attribute

Synopsis:

#include <pthread.h>

int pthread_attr_getsuspendstate_np(
                    const pthread_attr_t* attr,
                    int* suspend );

Arguments:

attr
A pointer to the pthread_attr_t structure that defines the attributes to use when creating new threads. For more information, see pthread_attr_init().
suspend
A pointer to a location where the function can store the thread suspend state, which is one of the following:
  • PTHREAD_CREATE_NOT_SUSPENDED — when the thread is created, it isn't put into a suspended state.
  • PTHREAD_CREATE_SUSPENDED — when the thread is created, it's put into a suspended state.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_attr_getsuspendstate_np() function gets the thread suspend state attribute from the thread attribute object attr and returns it in suspend. You can use pthread_attr_setsuspendstate_np() to set the suspend state attribute.

The “np” in these functions' names stands for “non-POSIX.”

Starting a thread in a suspended state is the equivalent of creating a thread and immediately calling ThreadCtlExt(), specifying the thread ID and the _NTO_TCTL_ONE_THREAD_HOLD command. You can unsuspend the thread with the _NTO_TCTL_ONE_THREAD_CONT command.

Returns:

EOK
Success.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes