SIGSUSPEND(2)
π SIGSUSPEND(2) π
ok so bestie, welcome to sigsuspend β manual section 2, the system calls zone, and honestly? this one is a whole vibe. sit down, grab a strawberry π, we're talking about atomically releasing blocked signals and waiting for an interrupt. no cap.
β¨ NAME β¨
sigsuspend β atomically release blocked signals and wait for interrupt π
π LIBRARY π
Standard C Library (libc, -lc) π«Ά
πΈ SYNOPSIS πΈ
#include <signal.h>
int
sigsuspend(const sigset_t *sigmask);
π¦ DESCRIPTION π¦
ok so here's the tea β. The sigsuspend() system call temporarily changes the blocked signal mask to the set that sigmask points at, and then it justβ¦ waits for a signal to arrive π°οΈ. And on return, the previous set of masked signals gets restored, like nothing ever happened. main character energy fr.
The signal mask set is usually empty, which signals "hey, all signals are unblocked for the duration of this call" β¨.
Now for the normal usage, because this part is important and lowkey iconic:
- You block a signal using
sigprocmask(2)to begin a critical section π - You examine the variables that get modified when that signal occurs, to determine that there is no work to be done π
- Then the process pauses awaiting work by using
sigsuspend()with the previous mask returned bysigprocmask(2)π΄
it's giving "check if there's anything to do, then nap until the universe pings me" π
π₯ RETURN VALUES π₯
The sigsuspend() system call always terminates by being interrupted π, returning -1 with errno set to EINTR. that's not a bug bestie that's the whole point π
π SEE ALSO π
pselect(2)sigaction(2)sigpending(2)sigprocmask(2)sigtimedwait(2)sigwait(2)sigwaitinfo(2)sigsetops(3)
go read the whole friend group, they all hang out together π
β STANDARDS β
The sigsuspend() system call is expected to conform to ISO/IEC 9945-1:1990 ("POSIX.1") π. yes she's certified. we love a standards-compliant queen.
and that's the whole page bestie!! π§ this one came from the Debian crew, dated August 16, 2013 β so yeah she's a lil vintage but she ATE and she's still serving. mwah πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms