static public Method

Thread.exclusive() { || ... }

Wraps a block in Thread.critical, restoring the original value upon exit from the critical section.

Source Code

# File thread.rb, line 24
def Thread.exclusive
  _old = Thread.critical
  begin
    Thread.critical = true
    return yield
  ensure
    Thread.critical = _old
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.