Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
About MagmaCounter
Last updated at 9:28 pm UTC on 19 April 2011
A MagmaCounter is a shared counter that allows full concurrent access, lock-free. To create a new MagmaCounter:
    myCounter := MagmaCounter new


To increment the counter:
    myCounter increment: 10


adds 10 to the counter.

It can also be decremented:
    myCounter decrement: 1


The counter always represents the total every client has incremented/decremented it.

For a demonstration, see #testMagmaCounter.