1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/test_mutex_m.rb
akr e6f6033b16 * lib/optparse.rb: suppress a warning.
* test/test_mutex_m.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-10 12:02:52 +00:00

26 lines
529 B
Ruby

require 'test/unit'
require 'thread'
require 'mutex_m'
class TestMutexM < Test::Unit::TestCase
def test_cv_wait
o = Object.new
o.instance_variable_set(:@foo, nil)
o.extend(Mutex_m)
c = ConditionVariable.new
t = Thread.start {
o.synchronize do
until foo = o.instance_variable_get(:@foo)
c.wait(o)
end
foo
end
}
sleep(0.0001)
o.synchronize do
o.instance_variable_set(:@foo, "abc")
end
c.signal
assert_equal "abc", t.value
end
end