# Cache: use mutex to protect recent_problematic_timestamp · gitcafe/zig

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

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

Visibility: public

Requested revision: 3e618f8432533eaa1cf6dcb39bdcb1b2e5bc1e47

Requested commit: 3e618f8432533eaa1cf6dcb39bdcb1b2e5bc1e47

Commit: 3e618f8432533eaa1cf6dcb39bdcb1b2e5bc1e47

Tree: be4d87aea477a27bfb5d32d069df2dbee067407b

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Cache: use mutex to protect recent_problematic_timestamp

The previous commit tried to use atomics but not many CPUs support
128-bit atomics. So we use a mutex. In order to avoid contention, we
also store `recent_problematic_timestamp` locally on the `Manifest`
which is only ever accessed from a single thread at a time, and only
consult the global one if the local one is problematic.

This commit was tested by running `zig build test-behavior` in two
separate terminals at the same time.

```

## Parents

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

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