Sha256: a2798e92d1c3f929daa706e188bd9b0a351be4ef5f52ec8a8665a19f3ebaa724

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 KB

Contents

require 'concurrent/collection/map/non_concurrent_map_backend'

module Concurrent

  # @!visibility private
  module Collection

    # @!visibility private
    class SynchronizedMapBackend < NonConcurrentMapBackend

      def initialize(*args, &block)
        super

        # WARNING: Mutex is a non-reentrant lock, so the synchronized methods are
        # not allowed to call each other.
        @mutex = Mutex.new
      end

      def [](key)
        @mutex.synchronize { super }
      end

      def []=(key, value)
        @mutex.synchronize { super }
      end

      def compute_if_absent(key)
        @mutex.synchronize { super }
      end

      def compute_if_present(key)
        @mutex.synchronize { super }
      end

      def compute(key)
        @mutex.synchronize { super }
      end

      def merge_pair(key, value)
        @mutex.synchronize { super }
      end

      def replace_pair(key, old_value, new_value)
        @mutex.synchronize { super }
      end

      def replace_if_exists(key, new_value)
        @mutex.synchronize { super }
      end

      def get_and_set(key, value)
        @mutex.synchronize { super }
      end

      def key?(key)
        @mutex.synchronize { super }
      end

      def delete(key)
        @mutex.synchronize { super }
      end

      def delete_pair(key, value)
        @mutex.synchronize { super }
      end

      def clear
        @mutex.synchronize { super }
      end

      def size
        @mutex.synchronize { super }
      end

      def get_or_default(key, default_value)
        @mutex.synchronize { super }
      end

      private
      def dupped_backend
        @mutex.synchronize { super }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 8 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
concurrent-ruby-1.3.4 lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.3/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.3.3/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.3/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
concurrent-ruby-1.3.3 lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
concurrent-ruby-1.3.2 lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.1/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
concurrent-ruby-1.3.1 lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
concurrent-ruby-1.3.1.pre lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
concurrent-ruby-1.2.3 lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb