Well, that depends on your definition of "natural". In my definition, it
would be absolutely normal in this example for the compiler to cache
jiffies because it considers it as a non-changing variable if none of the
code inside the while loop refers to jiffies again. But that's just me...
>If you like this code more :
>
>for (;;) {
> barrier();
> if (jiffies >= ...)
> break;
> ...
>}
Er, what is wrong with:
while (barrier(), jiffies < ...) {
...
}
It is just as clean as the starting point but tells both the compiler at
compile time and _me_ when reading the code that jiffies is expected to
change under me.
That is _way_ better than declaring it volatile in some obsure header file
which, chances are, I have never looked at, or looked at and long forgotten
about...
Just my 2p.
Anton
-- "Nothing succeeds like success." - Alexandre Dumas-- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/ ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/