"Roy T. Fielding" <[EMAIL PROTECTED]> writes:

>                                         Likewise, even a mid-update context
> switch doesn't matter for a variable that is only incremented/decremented.

only if the variable is used for an approximation :)

      x = 0

                 thread1                            thread2

                 load x into reg A                  load x into reg A
                 TIMESLICE                          increment reg A
                 (sleeping)                         store reg A at x
                 DISPATCH
                 increment reg A
                 store reg A at x

      x has been incremented twice and now has value 1

compare-and-swap can be used for this.
-- 
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Reply via email to