Comment on Correctly implementing a spinlock in Modern C++parentComments−dataflow5yCan happen at any moment != will happen most of the time−inshadows5yPreemption sure is non-deterministic from POV of the thread. But what's the point of it anyway? It's not like you handle HW interrupts in user-space and need to wait for some value in memory mapped register.−dataflow5yBut what's the point of it anyway?Some people empirically find it improves their applications' performances in some situations.−anarazel5yIt's also not rare to end up needing spinlocks within more elaborate lock implementations or within other low level primitives.
Comments
Can happen at any moment != will happen most of the time
Preemption sure is non-deterministic from POV of the thread. But what's the point of it anyway? It's not like you handle HW interrupts in user-space and need to wait for some value in memory mapped register.
Some people empirically find it improves their applications' performances in some situations.
It's also not rare to end up needing spinlocks within more elaborate lock implementations or within other low level primitives.