Nobuyoshi Nakada
070557afc4
Distinguish signal and timeout [Bug #16608 ]
2021-07-25 13:09:03 -07:00
Nobuyoshi Nakada
9eae8cdefb
Prefer qualified names under Thread
2021-06-29 11:41:10 +09:00
Benoit Daloze
3a3b19b2bb
Fix Monitor to lock per Fiber, like Mutex [Bug #17827 ]
2021-04-27 18:42:50 +02:00
Masataka Pocke Kuwabara
8d2333019a
Fix MonitorMixin when the super's initialize has kwargs
2020-07-17 16:37:18 -07:00
Koichi Sasada
c6e3db0c66
new_cond before mon_initialize
...
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-12-04 13:36:41 +09:00
Koichi Sasada
fd6445b7e8
Monitor#exit: check monitor ownership.
...
Monitor#exit should be called by only onwer Thread. However, there
is not check for it.
2019-11-12 10:07:45 +09:00
Koichi Sasada
caac5f777a
make monitor.so for performance. ( #2576 )
...
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.
2019-10-20 04:52:20 +09:00
Nobuyoshi Nakada
c52dad0ecf
Wait for the helper thread to terminate
2019-06-28 14:54:00 +09:00
shugo
6ec1720aa3
lib/monitor.rb: avoid race conditions by Thread.handle_interrupt
...
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-28 01:51:44 +00:00
kazu
6064132c42
Remove unnecessary `require 'thread'`
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 07:00:01 +00:00
shugo
da1b14bcec
Add MonitorMinx#mon_locked? and #mon_owned? to check states of objects
...
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
2017-09-20 01:40:53 +00:00
nobu
4b298ad77a
Use qualified names
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 06:22:30 +00:00
naruse
3e92b635fb
Add frozen_string_literal: false for all files
...
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-12-16 05:07:31 +00:00
shugo
7be5169804
* lib/monitor.rb (mon_try_enter, mon_enter): should reset @mon_count
...
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
2015-05-18 04:56:22 +00:00
akr
b19c39f94f
* test/monitor/test_monitor.rb: Use assert_join_threads.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 13:04:43 +00:00
akr
6f6dd30dbf
Join threads.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-31 15:31:46 +00:00
nobu
72c4c9edda
test_monitor.rb: fix leaked threads
...
* 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-05-26 08:04:02 +00:00
hsbt
5691727653
* test/monitor/test_monitor.rb: remove unused variabels.
...
* 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
2014-02-21 01:53:38 +00:00
shugo
332e8fe51f
* lib/monitor.rb (wait): supported timeout.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-06 12:31:52 +00:00
nahi
070cbd942e
* added monitor.rb test. see #2240 the bug on ruby_1_8.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 15:57:39 +00:00
shugo
1adef15072
* lib/thread.rb (ConditionVariable#broadcast): use Mutex
...
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
2007-02-24 07:01:18 +00:00
shugo
2a3f367151
* test/monitor/test_monitor.rb (test_cond): use Queue#deq
...
insteadof sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10 06:02:27 +00:00
shugo
ecec550855
* test/monitor/test_monitor.rb: fix the timing problem by Queue.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-12 05:10:54 +00:00
shugo
64446f023c
* test/monitor/test_monitor.rb: added.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-12 04:01:21 +00:00