Управление критическим разделом с помощью атомикиC++

Программы на C++. Форум разработчиков
Гость
Управление критическим разделом с помощью атомики

Сообщение Гость »


Почему-то мне пришло это в голову

Код: Выделить всё

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.


Источник: https://stackoverflow.com/questions/781 ... th-atomics

Вернуться в «C++»