Critical section control with atomics

26 views Asked by At

For some reason I got in my head that

if (someAtomicBool) return;
someAtomicBool = false;

Is adequate control for a critical section. This is not the case, right? I think the correct way to do this and achieve the functionality I'm looking for is to check if a mutex is locked or something.

0

There are 0 answers