Sha256: 024014097787ac4f77c2ac26bc0d2c3cdd87fca414dc916c4ce1b5d6a2f3cd5a

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

require 'test/unit'
if RUBY_PLATFORM == "java"
  require 'thread'
else
  $:.unshift File.expand_path( File.join( File.dirname( __FILE__ ), "../ext/fastthread" ) )
  require 'fastthread'
end

class TestCondVar < Test::Unit::TestCase
  def test_signal
    s = ""
    m = Mutex.new
    cv = ConditionVariable.new
    ready = false

    t = Thread.new do
      nil until m.synchronize { ready }
      m.synchronize { s << "b" }
      cv.signal
    end

    m.synchronize do
      s << "a"
      ready = true
      cv.wait m
      assert m.locked?
      s << "c"
    end

    t.join

    assert_equal "abc", s
  end
end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fastthread-0.6.1 test/test_condvar.rb
fastthread-0.6 test/test_condvar.rb