lkml.org 
[lkml]   [2000]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: (*(unsigned long *)&jiffies)++;
On Thu, 6 Jan 2000, Tigran Aivazian wrote:

>is because I suspected that some buggy versions of gcc ignore or mishandle
>it (and some people seem to confirm that, if you read this thread).

The below kind of increment is fine for a volatile variable. It's at least
what I expect the compiler doing for me.

movl foo,%eax ! Get it
leal 1(%eax),%edx ! bump it by one
movl %edx,foo ! write it back

>atomic_t jiffies). Therefore, the more economical way of writing is
>jiffies++;

Yes, more economical way for eyes.

>does not matter. Both are declared as volatile and yet jiffies were

lost_ticks_system is _not_ declared as volatile. And lost_ticks doesn't
need to be declared volatile as well, but not declaring it volatile won't
make any difference looking how it's used.

Only jiffies needs to be declared volatile because of free readers.

Andrea


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site