Commit aa832d6a6d
Changed files (1)
lib
std
lib/std/posix.zig
@@ -720,9 +720,19 @@ 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;
+ sigprocmask(SIG.BLOCK, &linux.all_mask, &set);
+
const tid = linux.gettid();
const rc = linux.tkill(tid, sig);
+ // restore signal mask
+ sigprocmask(SIG.SETMASK, &set, null);
+
switch (errno(rc)) {
.SUCCESS => return,
else => |err| return unexpectedErrno(err),