aboutsummaryrefslogtreecommitdiffstats
path: root/test/monitor
Commit message (Collapse)AuthorAgeFilesLines
* Fix MonitorMixin when the super's initialize has kwargsMasataka Pocke Kuwabara2020-07-171-0/+16
|
* new_cond before mon_initializeKoichi Sasada2019-12-041-0/+13
| | | | | | | 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
* Monitor#exit: check monitor ownership.Koichi Sasada2019-11-121-0/+23
| | | | | Monitor#exit should be called by only onwer Thread. However, there is not check for it.
* make monitor.so for performance. (#2576)Koichi Sasada2019-10-201-8/+8
| | | | | | | | | | | | | | | 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.
* Wait for the helper thread to terminateNobuyoshi Nakada2019-06-281-0/+2
|
* lib/monitor.rb: avoid race conditions by Thread.handle_interruptshugo2018-11-281-0/+22
| | | | | | 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
* revert r65822shugo2018-11-201-37/+0
| | | | | | | | | | | | | | | | | | 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
* lib/monitor.rb: prevent to initialize MonitorMixin twiceshugo2018-11-201-0/+37
| | | | | | 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
* Remove unnecessary `require 'thread'`kazu2017-10-081-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add MonitorMinx#mon_locked? and #mon_owned? to check states of objectsshugo2017-09-201-0/+29
| | | | | | 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
* Use qualified namesnobu2016-08-301-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | 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
* * lib/monitor.rb (mon_try_enter, mon_enter): should reset @mon_countshugo2015-05-181-0/+32
| | | | | | | 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
* * test/monitor/test_monitor.rb: Use assert_join_threads.akr2014-11-131-60/+72
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Join threads.akr2014-05-311-4/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_monitor.rb: fix leaked threadsnobu2014-05-261-0/+3
| | | | | | | * 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
* * test/monitor/test_monitor.rb: remove unused variabels.hsbt2014-02-211-1/+1
| | | | | | | | * 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
* * lib/monitor.rb (wait): supported timeout.shugo2010-02-061-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * added monitor.rb test. see #2240 the bug on ruby_1_8.nahi2009-10-201-0/+27
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/thread.rb (ConditionVariable#broadcast): use Mutexshugo2007-02-241-0/+2
| | | | | | | | | | 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
* * test/monitor/test_monitor.rb (test_cond): use Queue#deqshugo2003-12-101-1/+3
| | | | | | | insteadof sleep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/monitor/test_monitor.rb: fix the timing problem by Queue.shugo2003-11-121-32/+47
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/monitor/test_monitor.rb: added.shugo2003-11-121-0/+144
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e