Class: ThreadSafe::Util::Striped64::Cell

Inherits:
AtomicReference
  • Object
show all
Defined in:
lib/thread_safe/util/striped64.rb

Overview

Padded variant of AtomicLong supporting only raw accesses plus CAS. The value field is placed between pads, hoping that the JVM doesn't reorder them.

Optimisation note: It would be possible to use a release-only form of CAS here, if it were provided.

Instance Method Summary collapse

Instance Method Details

#cas_computedObject


81
82
83
# File 'lib/thread_safe/util/striped64.rb', line 81

def cas_computed
  cas(current_value = value, yield(current_value))
end