Sha256: da6adae31e8fb8724285855bb3a409be56efb24c03c98c6d36e70ca2b8df580c

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

module EventMachine
  module Synchrony
    module Thread

      # Fiber-aware drop-in replacements for thread objects
      class Mutex
        def synchronize( &blk )
          blk.call
        end
      end

      class ConditionVariable
        def wait( mutex )
          @deferrable = EventMachine::DefaultDeferrable.new
          EventMachine::Synchrony.sync @deferrable
          @deferrable = nil
        end

        def signal
          @deferrable and @deferrable.succeed
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
em-synchrony-1.0.0 lib/em-synchrony/thread.rb
em-synchrony-0.3.0.beta.1 lib/em-synchrony/thread.rb
em-synchrony-0.2.0 lib/em-synchrony/thread.rb