I am confused. How is it possible that implementation may know if type is atomic only at runtime?
The compiler may not know what CPU the code will run on, and CPUs may differ in their lock-free capabilities. For example, a CPU may not support atomic operations on long
types (and so a lock may be needed), but if the system has only a single core, they may be atomic automatically because they can't be interrupted and there's no other core to race with (and so nothing special is needed and the type is lock free).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With