2 ms·
Why is a thread local variable atomic?
by netheril96 10y ago
Why is a thread local variable atomic?
- burntsushi 10y agoBecause 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.)