--------------------------------------------------------------------------------
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume
                                       1
--------------------------------------------------------------------------------

pthread_kill Subroutine

Purpose

Sends a signal to the specified thread.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_kill (pthread_t thread, int sig);

Description

The pthread_kill subroutine sends the signal signal to the thread thread. It acts
with threads like the kill subroutine with single-threaded processes.

If the receiving thread has blocked delivery of the signal, the signal remains
pending on the thread until the thread unblocks delivery of the signal or the
action associated with the signal is set to ignore the signal.

    Note: 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.

Parameters

thread Specifies the target thread for the signal.

signal Specifies the signal to be delivered. If the signal value is 0, error
checking is performed, but no signal is delivered.

Return Values

Upon successful completion, the function returns a value of zero. Otherwise the
function returns an error number. If the pthread_kill function fails, no signal
is sent.

Error Codes

The pthread_kill function will fail if:

ESRCH No thread could be found corresponding to that specified by the given
thread ID.

EINVAL The value of the sig argument is an invalid or unsupported signal number.

The pthread_kill function will not return an error code of EINTR.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The kill subroutine, pthread_cancel subroutine, pthread_create subroutine,
sigaction subroutine, pthread_self subroutine, raise subroutine, pthread.h file.

Signal Management in AIX Version 4.3 General Programming Concepts: Writing and
Debugging Programs.

Threads Library Quick Reference in AIX Version 4.3 General Programming Concepts:
Writing and Debugging Programs.
--------------------------------------------------------------------------------