In the following code:

a++

if (a > 5) {
  .....
} else {


}

Is it possible for "a++" to be swapped with the if-block?  If so, then
can I stop this reordering by making a as atomic_t?


In the second case:
....
spin_lock(&lock);
a++;
spin_unlock(&lock);
....
Is it possible for instructions to be reordered across a spin_lock
primitive?  If this is possible, then spinlocks will be pretty
useless........

Thanks!

Mark

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to