On 13/03/2015 09:16, Fam Zheng wrote: >>> > > + if (atomic_cmpxchg(&bounce.in_use, false, true)) { >> > >> > atomic_or is enough... > atomic_cmpxchg is here to take the ownership of bounce iff it is not in use, > so > I think it is necessary.
It's changing false to true and true to true, so you can do if (atomic_or(&bounce.in_use, 1)) { // was true already } Paolo