|
|
|
|
|
by gpderetta
2357 days ago
|
|
according to cppreference: "Even if the shared variable is atomic, it must be modified under the mutex in order to correctly publish the modification to the waiting thread." That's not normative but I can't be bothered to check the c++ standard for exact wordings. Also SuSv4 doesn't have an explicit prohibition on modifying the predicate outside a critical section. But if you do, you are truly on your own. |
|
So simply using an atomic (even with a full release-acquire memory barrier) is not necessarily sufficient as that would only enforce the coherence but not prevent the scheduler from interrupting at the wrong moment.