module Concurrent::Synchronization::Volatile::ClassMethods
def attr_volatile(*names)
def attr_volatile(*names) names.each do |name| ivar = :"@volatile_#{name}" class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name} #{ivar} end def #{name}=(value) #{ivar} = value end RUBY end names.map { |n| [n, :"#{n}="] }.flatten end
def attr_volatile(*names)
def attr_volatile(*names) names.each do |name| ivar = :"@volatile_#{name}" class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name} ::Concurrent::Synchronization::JRubyAttrVolatile.instance_variable_get_volatile(self, :#{ivar}) end def #{name}=(value) ::Concurrent::Synchronization::JRubyAttrVolatile.instance_variable_set_volatile(self, :#{ivar}, value) end RUBY end names.map { |n| [n, :"#{n}="] }.flatten end
def attr_volatile(*names)
def attr_volatile(*names) names.each do |name| ivar = :"@volatile_#{name}" class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name} ::Concurrent::Synchronization.full_memory_barrier #{ivar} end def #{name}=(value) #{ivar} = value ::Concurrent::Synchronization.full_memory_barrier end RUBY end names.map { |n| [n, :"#{n}="] }.flatten end