3 ms·
No, Rust doesn't have semaphores in the stdlib[0] because it was not clear what precise semantics should be supported, or what purpose they would serve since by
by masklinn 2y ago
No, Rust doesn't have semaphores in the stdlib[0] because it was not clear what precise semantics should be supported, or what purpose they would serve since by definition they can't mitigate exclusive and thus write access to a resource and mitigating access to code isn't much of a rust convention. And nobody has really championed their addition since.
Furthermore, they still present a fair amount of design challenges in the specific context of Rust: https://neosmart.net/blog/implementing-truly-safe-semaphores-in-rust/ https://neosmart.net/blog/implementing-truly-safe-semaphores...
[0] technically they were there, added in 0.4, never stabilised, deprecated in 1.7, and removed in 1.8