back

by raphlinus·3y ago·view on hn ↗
Going through the comments provides another datapoint for what I have observed as an ironclad law: the first version of any code involving tricky atomics and synchronization is always wrong. Reasoning about these things is hard for human brains.

I strongly recommend using tools when viable. In Rust a particularly easy-to-use and effective one is loom[1]. Alloy is another good tool that scales well but requires investment. In some cases like the Vulkan memory model, Alloy files are available[2].

[1]: https://docs.rs/loom/latest/loom/

[2]: https://github.com/KhronosGroup/Vulkan-MemoryModel