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

>Andrea Arcangeli wrote:
>>
>> > movl foo,%eax ! Get it
>> > leal 1(%eax),%edx ! bump it by one
>> > movl %edx,foo ! write it back
>>
>> The above is perfect for a volatile variable IMHO. Also incl (without lock
>> on the bus) is not atomic in SMP.
>
>AFAIK incl _lock_ the bus even without "lock" in fornt of the
>instruction

The lock on the bus is _necessary_ in SMP. It would be very bad if each
incl would implicitly do a lock on the bus. It would forbid you to use
incl in SMP for single threaded code (for example inside critical
sections).

Even if it would lock on the bus it wouldn't matter. C only knows about
signle threading. So as far as C is concerned it's fine if it doesn't use
incl for incrementing volatile variables IMHO.

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-2014 Jasper Spaans. Advertise on this site