Class: Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/rubysl/thread/thread.rb

Class Method Summary collapse

Class Method Details

.exclusiveObject

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



29
30
31
32
33
34
35
36
37
# File 'lib/rubysl/thread/thread.rb', line 29

def Thread.exclusive
  _old = Thread.critical
  begin
    Thread.critical = true
    return yield
  ensure
    Thread.critical = _old
  end
end