原子运算符++和atomic_fetch_add_explicit之间的区别

时间:2019-05-26 14:10:21

标签: c multithreading atomic

两者之间有什么区别

atomic_int s = 0;
++s; //does s++ work as well?

和:

atomic_int s = 0;
atomic_fetch_add_explicit(&s, 1, memory_order_relaxed);

它们都是原子增量吗?

0 个答案:

没有答案