Sha256: 07511145d61730336074a51275675776d8f3b032b626a1eefa90f6604e71647f

Contents?: true

Size: 628 Bytes

Versions: 19

Compression:

Stored size: 628 Bytes

Contents

require 'test/unit'
require 'thread'
if RUBY_PLATFORM != "java"
  $:.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 ( Thread.pass ; 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

19 entries across 19 versions & 4 rubygems

Version Path
blackwinter-fastthread-1.0.5 test/test_condvar.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/fastthread-1.0.7/test/test_condvar.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/fastthread-1.0.1/test/test_condvar.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/fastthread-1.0.1/test/test_condvar.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/fastthread-1.0.1/test/test_condvar.rb
blackwinter-fastthread-1.0.7 test/test_condvar.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/fastthread-1.0.1/test/test_condvar.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/fastthread-1.0.1/test/test_condvar.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/fastthread-1.0.1/test/test_condvar.rb
fastthread-1.0.1-i386-mswin32 test/test_condvar.rb
fastthread-0.6.4.1 test/test_condvar.rb
fastthread-1.0.6 test/test_condvar.rb
fastthread-1.0.1 test/test_condvar.rb
fastthread-1.0.3 test/test_condvar.rb
fastthread-1.0.4 test/test_condvar.rb
fastthread-0.6.3 test/test_condvar.rb
fastthread-1.0.5 test/test_condvar.rb
fastthread-1.0 test/test_condvar.rb
fastthread-1.0.7 test/test_condvar.rb