diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/monitor.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/monitor.rb b/lib/monitor.rb index 4c146c8086..9158f9fb32 100644 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -288,11 +288,15 @@ module MonitorMixin @mon_owner = Thread.current end + # mon_release requires Thread.critical == true def mon_release @mon_owner = nil - t = @mon_waiting_queue.shift - t = @mon_entering_queue.shift unless t - t.wakeup if t + while t = @mon_waiting_queue.shift || @mon_entering_queue.shift + if t.alive? + t.wakeup + return + end + end end def mon_enter_for_cond(count) |