pthread_sigqueue(3)
β¨ pthread_sigqueue(3) β¨
okay bestie, so this one lives in the Library Functions Manual and it's a libc-adjacent baddie β let's get into it π
πΈ NAME πΈ
pthread_sigqueue β queue a signal and data to a thread π
π LIBRARY π
POSIX threads library β link it with -lpthread, and note that the actual library you're pulling in is libpthread. slay. π
β¨ SYNOPSIS β¨
#include <signal.h>
#include <pthread.h>
int pthread_sigqueue(pthread_t thread, int sig,
const union sigval value);
π¦ Feature Test Macro Requirements for glibc π¦
(if you wanna know how this whole feature-test-macro thing works, go peek at feature_test_macros(7), bestie)
pthread_sigqueue():_GNU_SOURCE
ik ik, the macro gating is real. set _GNU_SOURCE or this function is just not gonna show up. no cap.
π DESCRIPTION π
So pthread_sigqueue() basically does the same job as sigqueue(3)β¦ except instead of yeeting a signal at a whole process, it sends the signal to a single thread in the same process as the calling thread. it's giving targeted delivery. π―
threadβ the ID of a thread that lives in the same process as the caller.sigβ the signal you wanna send.valueβ the data that tags along with the signal. (head tosigqueue(3)if you want the full breakdown of that part π¬)
π₯ RETURN VALUE π₯
- On success,
pthread_sigqueue()returns0. π«Ά - On error, it returns an error number. (yes, an error number, not setting
errnoβ that's just how the pthread girlies do it)
π ERRORS π
EAGAINβ the limit of signals that may be queued has been reached. like the queue said "no more room, babe" π (seesignal(7)for the deets)EINVALβsigwas invalid. nope, not that one.ENOSYSβpthread_sigqueue()is not supported on this system. she's simply not available here πESRCHβthreadis not valid. that thread? doesn't exist. gone. π
π ATTRIBUTES π
want the definition of the terms used in this section? go read attributes(7), i'll wait π
pthread_sigqueue()β Thread safety attribute: MT-Safe β¨
so yeah, it's MT-Safe, we love a thread-safe icon.
β VERSIONS β
Heads up: the glibc implementation of pthread_sigqueue() throws an error (EINVAL) if you try to send either of the real-time signals that the NPTL threading implementation uses internally. that's intentional, not a bug. nptl(7) has the details if you're curious π
π STANDARDS π
GNU. that's it, that's the standard. periodt.
π§ HISTORY π§
glibc 2.11 β she's been around a minute π
π SEE ALSO π
and that's the whole page, bestie π«Ά this was Linux man-pages 6.20, dated 2026-02-08, and honestly? iconic. go queue a signal to a thread, you've earned it πβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2010, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms