Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2005-04-06 13:01:34


Alexander Terekhov wrote:
[...]
> Got it now. Thanks.

  asm long atomic_decrement_weak( register long * pw ) {

      <load-UNreserved>
      <add -1>
      <branch if zero to acquire>

      {lw}sync

    loop:

      <load-reserved>
      <add -1>
      <branch if zero to acquire>
      <store-conditional>
      <branch if failed to loop else to done>

    acquire:

      isync

    done:

      <...>
  }

 asm long atomic_decrement_strong( register long * pw ) {

    // Peter's state machine

    loop0:

      <load-reserved>
      <add -1>
      <branch if zero to loop0_acquire>

      {lw}sync

    loop1:

      <store-conditional>
      <branch if !failed to done>

    loop2:

      <load-reserved>
      <add -1>
      <branch if !zero to loop1>
      <store-conditional>
      <branch if failed to loop2 else to acquire>

    loop0_acquire:

      <store-conditional>
      <branch if failed to loop0>

    acquire:

      isync

    done:

      <...>
  }

All right now?

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk