Is accessing a variable of type sig_atomic_t with pointer atomic
I want to have a hash table where access to every element should be atomic and I don't want to use开发者_Go百科 locks. Can I use pointers to refer variables of type sig_atomic_t?
No. sig_atomic_t
is for signal handlers, it doesn't do anything to make values visible to other CPU's or to impose any ordering of memory accesses. C1x and C++0x have new atomic types (<stdatomic.h>
for C1x).
精彩评论