| ... | @@ -720,9 +720,19 @@ pub fn raise(sig: u8) RaiseError!void { | ... | @@ -720,9 +720,19 @@ pub fn raise(sig: u8) RaiseError!void { |
| 720 | } | 720 | } |
| 721 | | 721 | |
| 722 | if (native_os == .linux) { | 722 | if (native_os == .linux) { |
| | 723 | // https://git.musl-libc.org/cgit/musl/commit/?id=0bed7e0acfd34e3fb63ca0e4d99b7592571355a9 |
| | 724 | // |
| | 725 | // Unlike musl, libc-less Zig std does not have any internal signals for implementation purposes, so we |
| | 726 | // need to block all signals on the assumption that any of them could potentially fork() in a handler. |
| | 727 | var set: sigset_t = undefined; |
| | 728 | sigprocmask(SIG.BLOCK, &linux.all_mask, &set); |
| | 729 | |
| 723 | const tid = linux.gettid(); | 730 | const tid = linux.gettid(); |
| 724 | const rc = linux.tkill(tid, sig); | 731 | const rc = linux.tkill(tid, sig); |
| 725 | | 732 | |
| | 733 | // restore signal mask |
| | 734 | sigprocmask(SIG.SETMASK, &set, null); |
| | 735 | |
| 726 | switch (errno(rc)) { | 736 | switch (errno(rc)) { |
| 727 | .SUCCESS => return, | 737 | .SUCCESS => return, |
| 728 | else => |err| return unexpectedErrno(err), | 738 | else => |err| return unexpectedErrno(err), |