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
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/condition.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/condition.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/condition.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/condition.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/condition.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/synchronization/condition.rb
o-concurrent-ruby-1.1.13 lib/concurrent-ruby/concurrent/synchronization/condition.rb
o-concurrent-ruby-1.1.12 lib/concurrent-ruby/concurrent/synchronization/condition.rb
o-concurrent-ruby-1.1.11 lib/concurrent-ruby/concurrent/synchronization/condition.rb
concurrent-ruby-1.1.10 lib/concurrent-ruby/concurrent/synchronization/condition.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/condition.rb