class Concurrent::ThreadSafe::Util::Striped64::Cell
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.
@!visibility private
Public Class Methods
padding()
click to toggle source
@!visibility private
# File lib/concurrent/thread_safe/util/striped64.rb, line 96 def self.padding # TODO: this only adds padding after the :value slot, need to find a way to add padding before the slot # TODO (pitr-ch 28-Jul-2018): the padding instance vars may not be created # hide from yardoc in a method attr_reader *(12.times.collect{ |i| "padding_#{i}".to_sym }) end
Public Instance Methods
cas_computed() { |current_value| ... }
click to toggle source
# File lib/concurrent/thread_safe/util/striped64.rb, line 91 def cas_computed cas(current_value = value, yield(current_value)) end