From a0a3c701816c2fe4ab6e940c6cf5638756ceb6dc Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Sun, 20 Oct 2019 14:21:04 +0900 Subject: [PATCH] delegate synchronize method Delegate MonitorMixin#synchronize body to Monitor#synchronize. It makes guarantee interrupt safe (because Monitor#synchronize is written in C). I thought Ruby implementation is also safe, but I got stuck failure so that I introduce this fix to guarantee interrupt safe. --- ext/monitor/lib/monitor.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ext/monitor/lib/monitor.rb b/ext/monitor/lib/monitor.rb index dba942c89a..f6b3023dd7 100644 --- a/ext/monitor/lib/monitor.rb +++ b/ext/monitor/lib/monitor.rb @@ -205,12 +205,7 @@ module MonitorMixin # +MonitorMixin+. # def mon_synchronize(&b) - @mon_data.enter - begin - yield - ensure - @mon_data.exit - end + @mon_data.synchronize(&b) end alias synchronize mon_synchronize