# std: block cancelation in default panic and segfault handlers · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/111165513156d5732d85e5ccb52b9d8bded41ffa)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 111165513156d5732d85e5ccb52b9d8bded41ffa

Requested commit: 111165513156d5732d85e5ccb52b9d8bded41ffa

Commit: 111165513156d5732d85e5ccb52b9d8bded41ffa

Tree: d92c2b23c5a611a3383cc4fe3fd441d1724fe831

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
std: block cancelation in default panic and segfault handlers

It doesn't make any sense for a task to be canceled while it's
panicking.

As a happy accident, this also solves some cases where safety panics in
`Io.Threaded` would cause stack traces not to print due to invalid
thread-local state: when cancelation is blocked, `Io.Threaded` doesn't
consult said thread-local state at all. For instance, try inserting a
panic just after a call to `Syscall.start()` in `Io.Threaded`, and then
call the `Io` function in question from a `concurrent` task. Before this
PR, the stack trace fails to print, because the panic handler sees the
thread-local cancelation state in an unexpected state, leading to a
recursive panic. After this PR, the stack trace prints fine.

```

## Parents

- [9d08eba2e111e96133b51c14aca7dc071920b6d2](https://git.cafe/gitcafe/zig/commit/9d08eba2e111e96133b51c14aca7dc071920b6d2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/111165513156d5732d85e5ccb52b9d8bded41ffa?format=markdown)
