1.\" $OpenBSD: thrkill.2,v 1.2 2016/03/19 21:56:12 guenther Exp $ 2.\" $NetBSD: kill.2,v 1.7 1995/02/27 12:33:53 cgd Exp $ 3.\" 4.\" Copyright (c) 1980, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)kill.2 8.3 (Berkeley) 4/19/94 32.\" 33.Dd $Mdocdate: March 19 2016 $ 34.Dt THRKILL 2 35.Os 36.Sh NAME 37.Nm thrkill 38.Nd send signal to a thread in the same process 39.Sh SYNOPSIS 40.In signal.h 41.Ft int 42.Fn thrkill "pid_t tid" "int sig" "void *tcb" 43.Sh DESCRIPTION 44The 45.Fn thrkill 46function sends the signal given by 47.Fa sig 48to 49.Fa tid , 50a thread in the same process as the caller. 51.Fn thrkill 52will only succeed if 53.Fa tcb 54is either 55.Dv NULL 56or the address of the thread control block (TCB) of the target thread. 57.Fa sig 58may be one of the signals specified in 59.Xr sigaction 2 60or it may be 0, in which case 61error checking is performed but no 62signal is actually sent. 63.Pp 64If 65.Fa tid 66is zero then the current thread is targeted. 67.Sh RETURN VALUES 68.Rv -std 69.Sh ERRORS 70.Fn thrkill 71will fail and no signal will be sent if: 72.Bl -tag -width Er 73.It Bq Er EINVAL 74.Fa sig 75is not a valid signal number. 76.It Bq Er ESRCH 77The process doesn't have a thread with thread ID 78.Fa tid . 79.It Bq Er ESRCH 80.Fa tcb 81is not 82.Dv NULL 83and not the TCB address of the thread with thread ID 84.Fa tid . 85.El 86.Sh SEE ALSO 87.Xr __get_tcb 2 , 88.Xr kill 2 , 89.Xr sigaction 2 , 90.Xr pthread_kill 3 , 91.Xr raise 3 92.Sh STANDARDS 93The 94.Fn thrkill 95function is specific to 96.Ox 97and should not be used in portable applications. 98Use 99.Xr pthread_kill 3 100instead. 101.Sh HISTORY 102The 103.Fn thrkill 104system call appeared in 105.Ox 5.9 . 106