summaryrefslogtreecommitdiff
path: root/test/monitor
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-20 03:56:51 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-20 03:56:51 +0000
commit0dfc5918ec19cb67d8a49915ad8ab177f56e4e73 (patch)
treebcf6a376e13dd981a73be23d7e8aa8b3b8dd8557 /test/monitor
parent312fc605c1e09c487f66c13fdbcf6bfff44d8b7f (diff)
revert r65822
Because mon_initialized may be used to re-initialize copied objects intentionally. mon_initialize_spec.rb fails: 1) MonitorMixin#mon_initialize can be called in initialize_copy to get a new Mutex and used with synchronize ERROR ThreadError: already initialized /home/shugo/src/ruby/lib/monitor.rb:255:in `mon_initialize' /home/shugo/src/ruby/spec/ruby/library/monitor/mon_initialize_spec.rb:19:in `initialize_copy' /home/shugo/src/ruby/spec/ruby/library/monitor/mon_initialize_spec.rb:28:in `initialize_dup' /home/shugo/src/ruby/spec/ruby/library/monitor/mon_initialize_spec.rb:28:in `dup' /home/shugo/src/ruby/spec/ruby/library/monitor/mon_initialize_spec.rb:28:in `block (2 levels) in <top (required)>' /home/shugo/src/ruby/spec/ruby/library/monitor/mon_initialize_spec.rb:4:in `<top (required)>' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/monitor')
-rw-r--r--test/monitor/test_monitor_mixin.rb37
1 files changed, 0 insertions, 37 deletions
diff --git a/test/monitor/test_monitor_mixin.rb b/test/monitor/test_monitor_mixin.rb
deleted file mode 100644
index 24ad6b7..0000000
--- a/test/monitor/test_monitor_mixin.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require 'monitor'
-
-class TestMonitorMixin < Test::Unit::TestCase
- def test_cond
- a = "foo"
- a.extend(MonitorMixin)
- cond = a.new_cond
- queue1 = Queue.new
- th = Thread.start do
- queue1.deq
- a.synchronize do
- a.replace("bar")
- cond.signal
- end
- end
- th2 = Thread.start do
- a.synchronize do
- queue1.enq(nil)
- assert_equal("foo", a)
- result1 = cond.wait
- assert_equal(true, result1)
- assert_equal("bar", a)
- end
- end
- assert_join_threads([th, th2])
- end
-
- def test_initialize_twice
- a = Object.new
- a.extend(MonitorMixin)
- assert_raise(ThreadError) do
- a.send(:mon_initialize)
- end
- end
-end