1
0
Fork 0
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:
Koichi Sasada 2019-10-20 15:45:30 +09:00
parent a0a3c70181
commit a236eaa762
2 changed files with 43 additions and 22 deletions

View file

@ -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
#