Sha256: 53ef353e8e0d49a2b44bd3588d0291fd242de013bb7b8e6114bf5c1cbda16606

Contents?: true

Size: 1.56 KB

Versions: 97

Compression:

Stored size: 1.56 KB

Contents

module Concurrent
  # noinspection RubyInstanceVariableNamingConvention
  module Synchronization

    # @!visibility private
    # @!macro internal_implementation_note
    module ConditionSignalling
      protected

      def ns_signal
        @__Condition__.signal
        self
      end

      def ns_broadcast
        @__Condition__.broadcast
        self
      end
    end


    # @!visibility private
    # @!macro internal_implementation_note
    class MutexLockableObject < AbstractLockableObject
      include ConditionSignalling

      safe_initialization!

      def initialize(*defaults)
        super(*defaults)
        @__Lock__      = ::Mutex.new
        @__Condition__ = ::ConditionVariable.new
      end

      protected

      def synchronize
        if @__Lock__.owned?
          yield
        else
          @__Lock__.synchronize { yield }
        end
      end

      def ns_wait(timeout = nil)
        @__Condition__.wait @__Lock__, timeout
        self
      end
    end

    # @!visibility private
    # @!macro internal_implementation_note
    class MonitorLockableObject < AbstractLockableObject
      include ConditionSignalling

      safe_initialization!

      def initialize(*defaults)
        super(*defaults)
        @__Lock__      = ::Monitor.new
        @__Condition__ = @__Lock__.new_cond
      end

      protected

      def synchronize # TODO may be a problem with lock.synchronize { lock.wait }
        @__Lock__.synchronize { yield }
      end

      def ns_wait(timeout = nil)
        @__Condition__.wait timeout
        self
      end
    end
  end
end

Version data entries

97 entries across 85 versions & 18 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/mutex_lockable_object.rb