summaryrefslogtreecommitdiff
path: root/test/monitor
AgeCommit message (Collapse)Author
2020-07-17Fix MonitorMixin when the super's initialize has kwargsMasataka Pocke Kuwabara
Notes: Merged: https://github.com/ruby/ruby/pull/3310
2019-12-04new_cond before mon_initializeKoichi Sasada
MonitorMixin#new_cond can be called before mon_initialize, so we need to initialize `@monitor` before it. https://bugs.ruby-lang.org/issues/16255#note-4
2019-11-12Monitor#exit: check monitor ownership.Koichi Sasada
Monitor#exit should be called by only onwer Thread. However, there is not check for it.
2019-10-20make monitor.so for performance. (#2576)Koichi Sasada
Recent monitor.rb has performance problem because of interrupt handlers. 'Monitor#synchronize' is frequently used primitive so the performance of this method is important. This patch rewrite 'monitor.rb' with 'monitor.so' (C-extension) and make it faster. See [Feature #16255] for details. Monitor class objects are normal object which include MonitorMixin. This patch introduce a Monitor class which is implemented on C and MonitorMixin uses Monitor object as re-entrant (recursive) Mutex. This technique improve performance because we don't need to care atomicity and we don't need accesses to instance variables any more on Monitor class. Notes: Merged-By: ko1 <ko1@atdot.net>
2019-06-28Wait for the helper thread to terminateNobuyoshi Nakada
2018-11-28lib/monitor.rb: avoid race conditions by Thread.handle_interruptshugo
Suggested by Benoit Daloze. [ruby-core:88502] [Bug #14998] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20revert r65822shugo
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
2018-11-20lib/monitor.rb: prevent to initialize MonitorMixin twiceshugo
Suggested by Benoit Daloze. [ruby-core:88504] [Feature #15000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08Remove unnecessary `require 'thread'`kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-20Add MonitorMinx#mon_locked? and #mon_owned? to check states of objectsshugo
Patched by Satoshi "Moris" Tagomori <tagomoris@gmail.com>. [Fix GH-1699] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30Use qualified namesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-18* lib/monitor.rb (mon_try_enter, mon_enter): should reset @mon_countshugo
just in case the previous owner thread dies without mon_exit. [fix GH-874] Patch by @chrisberkhout git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/monitor/test_monitor.rb: Use assert_join_threads.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-31Join threads.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-26test_monitor.rb: fix leaked threadsnobu
* test/monitor/test_monitor.rb (test_killed_thread_in_synchronize): join work threads not to leak threads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21* test/monitor/test_monitor.rb: remove unused variabels.hsbt
* test/resolv/test_dns.rb: ditto. * test/rexml/test_functions.rb: ditto. * test/rss/test_setup_maker_itunes.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-06* lib/monitor.rb (wait): supported timeout.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 * added monitor.rb test. see #2240 the bug on ruby_1_8.nahi
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24* lib/thread.rb (ConditionVariable#broadcast): use Mutexshugo
instead of Thread.exclusive. * lib/monitor.rb (MonitorMixin#mon_exit): unset @mon_owner before calling Mutex#unlock. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10* test/monitor/test_monitor.rb (test_cond): use Queue#deqshugo
insteadof sleep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-12* test/monitor/test_monitor.rb: fix the timing problem by Queue.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-12* test/monitor/test_monitor.rb: added.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e