mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.os.linux: block all signals in raise
This commit is contained in:
parent
06fc600aec
commit
d128f5c0bb
1 changed files with 5 additions and 2 deletions
|
|
@ -722,9 +722,12 @@ pub fn raise(sig: u8) RaiseError!void {
|
|||
}
|
||||
|
||||
if (native_os == .linux) {
|
||||
// https://git.musl-libc.org/cgit/musl/commit/?id=0bed7e0acfd34e3fb63ca0e4d99b7592571355a9
|
||||
//
|
||||
// Unlike musl, libc-less Zig std does not have any internal signals for implementation purposes, so we
|
||||
// need to block all signals on the assumption that any of them could potentially fork() in a handler.
|
||||
var set: sigset_t = undefined;
|
||||
// block application signals
|
||||
sigprocmask(SIG.BLOCK, &linux.app_mask, &set);
|
||||
sigprocmask(SIG.BLOCK, &linux.all_mask, &set);
|
||||
|
||||
const tid = linux.gettid();
|
||||
const rc = linux.tkill(tid, sig);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue