Сообщение Re[14]: volatile bool vs std::atomic_flag vs std::atomic<boo от 03.09.2015 7:12
Изменено 03.09.2015 9:12 uzhas
BFE>Ниже он пишет:
BFE>
BFE>The only way to guarantee you have the "latest" value is to use a read-modify-write operation such as exchange(), compare_exchange_strong() or fetch_add(). Read-modify-write operations have an additional constraint that they always operate on the "latest" value, so a sequence of ai.fetch_add(1) operations by a series of threads will return a sequence of values with no duplicates or gaps. In the absence of additional constraints, there's still no guarantee which threads will see which values though.
все правильно он пишет, тебе что-то здесь смущает?
BFE>Ниже он пишет:
BFE>
BFE>The only way to guarantee you have the "latest" value is to use a read-modify-write operation such as exchange(), compare_exchange_strong() or fetch_add(). Read-modify-write operations have an additional constraint that they always operate on the "latest" value, so a sequence of ai.fetch_add(1) operations by a series of threads will return a sequence of values with no duplicates or gaps. In the absence of additional constraints, there's still no guarantee which threads will see which values though.
все правильно он пишет, тебя что-то здесь смущает?