Re: atomic_set & gcc. atomicity question

Raj Inguva
2003-07-31T10:40:08Z

> #define atomic_set(v,i) (((v)->counter) = (i))

'v' is of type atomic_t which is a structure.

> If we call atomic_set() with constant 2nd argument it's ok - it's a > simple write to var. But what if we do atomic_set(var, var1+var2)?

It will expand to (((var)->counter) = (var1+var2))

'counter' is 'volatile' .