Hacker News new | ask | show | jobs
by netheril96 3466 days ago
Why is a thread local variable atomic?
1 comments

Because an atomic provides interior mutability for `usize`.

(It's a hack that plays on the GP's specific example of a counter. It doesn't generalize arbitrarily to removing use of RefCell for thread locals in safe code.)