apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: Conditionals...
Date Fri, 03 Aug 2001 23:15:14 GMT
"Roy T. Fielding" <fielding@ebuilt.com> 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
                 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 | trawick@attglobal.net | PGP public key at web site:
             Born in Roswell... married an alien...

View raw message