Sha256: b187c82482b4186372b153e7d9f3e0317f42f38ed3d339a29434d192a03db088

Contents?: true

Size: 1.43 KB

Versions: 104

Compression:

Stored size: 1.43 KB

Contents

module Concurrent
  module Synchronization

    # @!visibility private
    # TODO (pitr-ch 04-Dec-2016): should be in edge
    class Condition < LockableObject
      safe_initialization!

      # TODO (pitr 12-Sep-2015): locks two objects, improve
      # TODO (pitr 26-Sep-2015): study
      # http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/concurrent/locks/AbstractQueuedSynchronizer.java#AbstractQueuedSynchronizer.Node

      singleton_class.send :alias_method, :private_new, :new
      private_class_method :new

      def initialize(lock)
        super()
        @Lock = lock
      end

      def wait(timeout = nil)
        @Lock.synchronize { ns_wait(timeout) }
      end

      def ns_wait(timeout = nil)
        synchronize { super(timeout) }
      end

      def wait_until(timeout = nil, &condition)
        @Lock.synchronize { ns_wait_until(timeout, &condition) }
      end

      def ns_wait_until(timeout = nil, &condition)
        synchronize { super(timeout, &condition) }
      end

      def signal
        @Lock.synchronize { ns_signal }
      end

      def ns_signal
        synchronize { super }
      end

      def broadcast
        @Lock.synchronize { ns_broadcast }
      end

      def ns_broadcast
        synchronize { super }
      end
    end

    class LockableObject < LockableObjectImplementation
      def new_condition
        Condition.private_new(self)
      end
    end
  end
end

Version data entries

104 entries across 95 versions & 24 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
spiral_form-0.1.1 vendor/bundle/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
spiral_form-0.1.0 vendor/bundle/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
ric-0.13.0 vendor/bundle/ruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/concurrent-ruby-1.1.5/lib/concurrent/synchronization/condition.rb