# std.debug.SelfInfo: thread safety · gitcafe/zig

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

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

Visibility: public

Requested revision: 099a95041054e456ebefbd75f6a4f9f6961002be

Requested commit: 099a95041054e456ebefbd75f6a4f9f6961002be

Commit: 099a95041054e456ebefbd75f6a4f9f6961002be

Tree: 6293805ebdf2664d5b5906e614297972a7c8da6f

Author: mlugg

Committer: mlugg

## Message

```
std.debug.SelfInfo: thread safety

This has been a TODO for ages, but in the past it didn't really matter
because stack traces are typically printed to stderr for which a mutex
is held so in practice there was a mutex guarding usage of `SelfInfo`.

However, now that `SelfInfo` is also used for simply capturing traces,
thread safety is needed. Instead of just a single mutex, though, there
are a couple of different mutexes involved; this helps make critical
sections smaller, particularly when unwinding the stack as `unwindFrame`
doesn't typically need to hold any lock at all.

```

## Parents

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

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