mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Native MonitorMixin::ConditionVariable#wait
MonitorMixin::ConditionVariable#wait can be interrupted just after Monitor#exit_for_cond. So implementation in C.
This commit is contained in:
parent
a0a3c70181
commit
a236eaa762
2 changed files with 43 additions and 22 deletions
|
@ -105,13 +105,7 @@ module MonitorMixin
|
|||
#
|
||||
def wait(timeout = nil)
|
||||
@monitor.mon_check_owner
|
||||
count = @monitor.__send__(:exit_for_cond)
|
||||
begin
|
||||
@cond.wait(@monitor.__send__(:mutex_for_cond), timeout)
|
||||
return true
|
||||
ensure
|
||||
@monitor.__send__(:enter_for_cond, count)
|
||||
end
|
||||
@monitor.wait_for_cond(@cond, timeout)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue