summaryrefslogtreecommitdiff
path: root/lib/thread.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread.rb')
-rw-r--r--lib/thread.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/thread.rb b/lib/thread.rb
index 2769c54c3e9..3baa951522c 100644
--- a/lib/thread.rb
+++ b/lib/thread.rb
@@ -21,16 +21,18 @@ if $DEBUG
Thread.abort_on_exception = true
end
-#
-# FIXME: not documented in Pickaxe or Nutshell.
-#
-def Thread.exclusive
- _old = Thread.critical
- begin
- Thread.critical = true
- return yield
- ensure
- Thread.critical = _old
+class Thread
+ #
+ # FIXME: not documented in Pickaxe or Nutshell.
+ #
+ def Thread.exclusive
+ _old = Thread.critical
+ begin
+ Thread.critical = true
+ return yield
+ ensure
+ Thread.critical = _old
+ end
end
end