Sha256: f3fee59766c5493692c66ad0b21578f6ea645bfbd6ca31579ca65fccae4b4570
Contents?: true
Size: 1.61 KB
Versions: 6
Compression:
Stored size: 1.61 KB
Contents
module Concurrent module Synchronization # @!macro synchronization_object # @!visibility private class AbstractObject # @abstract has to be implemented based on Ruby runtime def initialize raise NotImplementedError end # @!macro [attach] synchronization_object_method_ensure_ivar_visibility # # Allows to construct immutable objects where all fields are visible after initialization, not requiring # further synchronization on access. # @example # class AClass # attr_reader :val # def initialize(val) # @val = val # final value, after assignment it's not changed (just convention, not enforced) # ensure_ivar_visibility! # # now it can be shared as Java's final field # end # end # @!visibility private def ensure_ivar_visibility! # We have to prevent ivar writes to reordered with storing of the final instance reference # Therefore wee need a fullFence to prevent reordering in both directions. full_memory_barrier end protected # @!visibility private # @abstract def full_memory_barrier raise NotImplementedError end # @!macro [attach] synchronization_object_method_self_attr_volatile # # creates methods for reading and writing to a instance variable with volatile (Java semantic) instance variable # return [Array<Symbol>] names of defined method names def self.attr_volatile(*names) raise NotImplementedError end end end end
Version data entries
6 entries across 6 versions & 1 rubygems