Sha256: b76cbd3af7bc45df92dd5ab137fc2bda53190ac2da28a5ebc00a5b4c0cf2a658

Contents?: true

Size: 842 Bytes

Versions: 6

Compression:

Stored size: 842 Bytes

Contents

module Concurrent
  module Synchronization


    # @!visibility private
    # @!macro internal_implementation_note
    class RbxObject < AbstractObject
      def initialize
        # nothing to do
      end

      def full_memory_barrier
        # Rubinius instance variables are not volatile so we need to insert barrier
        Rubinius.memory_barrier
      end

      def self.attr_volatile *names
        names.each do |name|
          ivar = :"@volatile_#{name}"
          class_eval <<-RUBY, __FILE__, __LINE__ + 1
            def #{name}
              Rubinius.memory_barrier
              #{ivar}
            end

            def #{name}=(value)
              #{ivar} = value
              Rubinius.memory_barrier
            end
          RUBY
        end
        names.map { |n| [n, :"#{n}="] }.flatten
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
concurrent-ruby-1.0.0.pre4-java lib/concurrent/synchronization/rbx_object.rb
concurrent-ruby-1.0.0.pre4 lib/concurrent/synchronization/rbx_object.rb
concurrent-ruby-1.0.0.pre3-java lib/concurrent/synchronization/rbx_object.rb
concurrent-ruby-1.0.0.pre3 lib/concurrent/synchronization/rbx_object.rb
concurrent-ruby-1.0.0.pre2-java lib/concurrent/synchronization/rbx_object.rb
concurrent-ruby-1.0.0.pre2 lib/concurrent/synchronization/rbx_object.rb