exclusive()
public
Wraps a block in Thread.critical, restoring the original value upon exit from the critical section.
Show source
def Thread.exclusive
_old = Thread.critical
begin
Thread.critical = true
return yield
ensure
Thread.critical = _old
end
end