Hacker News new | past | comments | ask | show | jobs | submit login

Thread locals are thread local, so you don't need AtomicUsize, you just need a Cell, which has zero overhead.

https://is.gd/c0iCz6

Edit: Zero overhead as compared to C, that is. Cell has a slight overhead in Rust because it prevents certain optimizations that aren't the default in C.




Derp. Thanks for that correction. :-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: