Sha256: b09e235b570ebacce5bacd5de27dfdc335d4f38b18a37cc9c8a4545414b50f76

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

module Concurrent
  module Synchronization

    if Concurrent.on_jruby? && Concurrent.java_extensions_loaded?

      # @!visibility private
      # @!macro internal_implementation_note
      class JRubyObject < AbstractObject

        def initialize
          # nothing to do
        end

        def self.attr_volatile(*names)
          names.each do |name|

            ivar = :"@volatile_#{name}"

            class_eval <<-RUBY, __FILE__, __LINE__ + 1
              def #{name}
                instance_variable_get_volatile(:#{ivar})
              end

              def #{name}=(value)
                instance_variable_set_volatile(:#{ivar}, value)
              end
            RUBY

          end
          names.map { |n| [n, :"#{n}="] }.flatten
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concurrent-ruby-1.0.0.pre4-java lib/concurrent/synchronization/jruby_object.rb
concurrent-ruby-1.0.0.pre4 lib/concurrent/synchronization/jruby_object.rb