summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fiber/test_mutex.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/fiber/test_mutex.rb b/test/fiber/test_mutex.rb
index baec559a70..a70c6992ab 100644
--- a/test/fiber/test_mutex.rb
+++ b/test/fiber/test_mutex.rb
@@ -47,6 +47,29 @@ class TestFiberMutex < Test::Unit::TestCase
thread.join
end
+ def test_mutex_thread
+ mutex = Mutex.new
+ mutex.lock
+
+ thread = Thread.new do
+ scheduler = Scheduler.new
+ Thread.current.scheduler = scheduler
+
+ Fiber.schedule do
+ mutex.lock
+ sleep 0.1
+ mutex.unlock
+ end
+
+ scheduler.run
+ end
+
+ sleep 0.1
+ mutex.unlock
+
+ thread.join
+ end
+
def test_condition_variable
mutex = Mutex.new
condition = ConditionVariable.new