xref: /freebsd/share/man/man3/pthread_sigqueue.3 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1.\" SPDX-License-Identifier: BSD-2-Clause
2.\"
3.\" Copyright 2024 The FreeBSD Foundation
4.\"
5.\" This documentation was written by
6.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
7.\" from the FreeBSD Foundation.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice(s), this list of conditions and the following disclaimer as
14.\"    the first lines of this file unmodified other than the possible
15.\"    addition of one or more copyright notices.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice(s), this list of conditions and the following disclaimer in
18.\"    the documentation and/or other materials provided with the
19.\"    distribution.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
22.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
25.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32.\"
33.Dd April 21, 2024
34.Dt PTHREAD_SIGQUEUE 3
35.Os
36.Sh NAME
37.Nm pthread_sigqueue
38.Nd queue a signal to a specified thread
39.Sh LIBRARY
40.Lb libpthread
41.Sh SYNOPSIS
42.In pthread.h
43.In signal.h
44.Ft int
45.Fn pthread_sigqueue "pthread_t thread" "int sig" "const union sigval value"
46.Sh DESCRIPTION
47The
48.Fn pthread_queue
49function queues a signal, specified by
50.Fa sig ,
51to a thread, specified by
52.Fa thread .
53If
54.Fa sig
55is 0, error checking is performed, but no signal is actually sent.
56The
57.Fa value
58is queued together with the signal, and becomes available in
59.Vt siginfo_t
60data passed to the signal handler.
61.Pp
62The
63.Nm
64function is similar to
65.Xr sigqueue 2 ,
66but targets a thread in the current process instead of a process.
67See
68.Xr sigqueue 2
69for details about signal queueing and delivery selection.
70.Sh RETURN VALUES
71If successful,
72.Fn pthread_sigqueue
73returns 0.
74Otherwise, an error number is returned.
75.Sh ERRORS
76The
77.Fn pthread_sigqueue
78function will fail if:
79.Bl -tag -width Er
80.It Bq Er EAGAIN
81No resources are available to queue the signal.
82The current process has already queued
83.Brq Dv SIGQUEUE_MAX
84signals that are still pending,
85or a system-wide resource limit has been exceeded.
86.It Bq Er ESRCH
87.Fa thread
88is an invalid thread ID.
89.It Bq Er EINVAL
90.Fa sig
91is an invalid or unsupported signal number.
92.El
93.Sh SEE ALSO
94.Xr sigqueue 2
95.Sh STANDARDS
96The
97.Fn pthread_sigqueue
98function is a
99.Fx
100extension.
101An identical function with the same semantic is available in other
102operating systems.
103