# std: introduce pointer stability locks to hash maps \(\#17719\) · gitcafe/zig

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

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

Visibility: public

Requested revision: 242ab81112c05fa815523551a6f612c5a12c52b2

Requested commit: 242ab81112c05fa815523551a6f612c5a12c52b2

Commit: 242ab81112c05fa815523551a6f612c5a12c52b2

Tree: 32b581f036137436932883ffdfab24aec64576db

Author: Andrew Kelley

Committer: GitHub

## Message

```
std: introduce pointer stability locks to hash maps (#17719)

This adds std.debug.SafetyLock and uses it in std.HashMapUnmanaged by
adding lockPointers() and unlockPointers().

This provides a way to detect when an illegal modification has happened and
panic rather than invoke undefined behavior.
```

## Parents

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

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