[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

pthread_signal_to_cancel_np Subroutine


Cancels the specified thread.


Threads Library (libpthreads.a)


#include <pthread.h>

int pthread_signal_to_cancel_np ( sigset, thread)
sigset_t *sigset;
pthread_t *thread;


The pthread_signal_to_cancel_np subroutine cancels the target thread thread by creating a handler thread. The handler thread calls the sigwait subroutine with the sigset parameter, and cancels the target thread when the sigwait subroutine returns. Successive calls to this subroutine override the previous ones.

  1. The pthread.h header file must be the first included file of each source file using the threads library. Otherwise, the -D_THREAD_SAFE compilation flag should be used, or the cc_r compiler used. In this case, the flag is automatically set.
  2. The pthread_signal_to_cancel_np subroutine is not portable.

This subroutine is not POSIX compliant and is provided only for compatibility with DCE threads. It should not be used when writing new applications.


sigset Specifies the set of signals to wait on.
thread Specifies the thread to cancel.

Return Values

Upon successful completion, 0 is returned. Otherwise, an error code is returned.

Error Codes

The pthread_signal_to_cancel_np subroutine is unsuccessful if the following is true:

EAGAIN The handler thread cannot be created.
EINVAL The sigset or thread parameters are not valid.

Related Information

The pthread_cancel (pthread_cancel Subroutine) subroutine, sigwait subroutine.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]