atomic_flag
在
cplusplus.com
164 errors from 28 contexts (suppressed: 0 from 0)
例如
==4868== Possible data race during read of size 1 at 0x605220 by thread #3
==4868== Locks held: none
==4868== at 0x401172: test_and_set (atomic_base.h:176)
==4868== by 0x401172: append_number(int) (helgrind_spinlock.cpp:12)
[output deleted]
==4868== This conflicts with a previous write of size 1 by thread #2
==4868== Locks held: none
==4868== at 0x4011C9: clear (atomic_base.h:193)
==4868== by 0x4011C9: append_number(int) (helgrind_spinlock.cpp:14)
[output deleted]
在正确使用
作为一个旋转锁,还是Helgrind给出了一个假阳性?