Thread::SigMask(3pm)

πŸ’– Thread::SigMask β€” thread-specific signal masks, bestie πŸ’–

okay so this is Thread::SigMask, a lil User Contributed Perl Documentation page (that's the manual name btw, we're in section 3pm, Perl module territory πŸŽ€) and it's giving "per-thread signal masks" and honestly? iconic.


✨ VERSION ✨

This is version 0.004. tiny number, big power πŸ’…


🌈 SYNOPSIS 🌈

use Thread::SigMask qw/sigset/;
use POSIX qw/SIG_BLOCK SIG_UNBLOCK/;

sigmask(SIG_BLOCK, $sigset);
...
sigmask(SIG_UNBLOCK, $sigset);

like literally just import sigset, grab a couple of constants from POSIX, block some stuff, unblock some stuff, done. periodt. πŸ¦‹


🌸 DESCRIPTION 🌸

So what does this actually do? This module hands you per-thread signal masks. 🫢

On non-threaded perls it's gonna be effectively the same as POSIX::sigprocmask β€” no cap, same thing, different day. And the interface? Works exactly the same as sigprocmask. Exactly. Not "kinda similar". Exactly. πŸ‘‘


πŸ’… FUNCTIONS πŸ’…

sigmask($how, $newset, $oldset = undef)

Change and/or examine the calling process's signal mask. This uses POSIX::SigSet objects for the newset and oldset arguments β€” you're not passing plain old arrays here, bestie, you're passing proper objects. 😌

The behavior of the call is dependent on the value of how:

  • SIG_BLOCK β€” the set of blocked signals becomes the union of the current set and the set argument. like a lil merge, they hold hands 🀝
  • SIG_UNBLOCK β€” the signals in set are removed from the current set of blocked signals. And yes, it is permissible to attempt to unblock a signal which is not blocked. go off, nothing's stopping you πŸŽ€
  • SIG_SETMASK β€” the set of blocked signals is simply set to the argument set. boom. replacement. πŸ”₯

Now for the argument tea β˜•:

If oldset is defined, the previous value of the signal mask is stored in oldset. If newset is NULL, then the signal mask is unchanged (i.e., how is ignored) β€” but the current value of the signal mask is nevertheless returned in oldset (if it is not NULL). so you can just peek at the mask without touching it. main character move, honestly. πŸ‘€

⚠️ lowkey important: NULL newset means how does literally nothing. don't come for me, that's just what it says. πŸ’€

πŸ” SEE ALSO πŸ”

  • Signal::Mask β€” the other one, go check it out, we support each other here 🫢

πŸ™ˆ ACKNOWLEDGEMENTS πŸ™ˆ

Parts of this documentation is shamelessly stolen from POSIX and Linux' sigprocmask(2). shameless. they said it, not me. and we respect it 🌸


πŸ‘‘ AUTHOR πŸ‘‘

Leon Timmermans <leont@cpan.org> β€” legend behaviour πŸ’œ


This software is copyright (c) 2010 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like, go wild, but legally. ✨


and that's the whole page, babe πŸ’– this doc came to you as part of the User Contributed Perl Documentation, running under perl v5.42.3, dated 2026-08-19 β€” mwah, take care of your signal masks, they're delicate πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from