Set the thread suspend state attribute
#include <pthread.h> int pthread_attr_setsuspendstate_np( pthread_attr_t* attr, int suspend );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pthread_attr_setsuspendstate_np() function sets the thread suspend state attribute in the thread attribute object attr to suspend. The default value for the thread suspend state is PTHREAD_CREATE_NOT_SUSPENDED.
You can use pthread_attr_getsuspendstate_np() to get 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.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |