by vmfunction · 3y ago · 0 comments
Isn't that implementation of semaphore? I would imagine that should already being done in the CPU implementation?
If you do use the atomic instructions, you're guaranteed a consistent view across threads for that location. Check your platform documentation as to whether this is also a memory barrier, affecting ordering between the atomic instruction and other non-atomic instructions.