method
safe
ruby latest stable - Class:
Finalizer
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.
safe()public
method to call finalize_* safely.
# File lib/finalize.rb, line 166
def safe
old_status = Thread.critical
Thread.critical = true
ObjectSpace.remove_finalizer(@proc)
begin
yield
ensure
ObjectSpace.add_finalizer(@proc)
Thread.critical = old_status
end
end