summaryrefslogtreecommitdiff
path: root/prelude.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 01:09:08 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 01:09:08 +0000
commitc289cf3a1ffa71217e597df051d945ff24126379 (patch)
treea48f154672e560c0c0fbc5d01c6c193588a012d0 /prelude.rb
parentbdf32ff14f062b1813ccbf71f47fb301a0f47513 (diff)
* prelude.rb: add Thread.exclusive. This class method
is different from 1.8's. Thread.exclusive only does synchronize with VM global mutex. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'prelude.rb')
-rw-r--r--prelude.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/prelude.rb b/prelude.rb
index 6451b8f74a..8ce306caa2 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -10,3 +10,14 @@ class Mutex
end
end
+# Thread
+
+class Thread
+ MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new
+ def self.exclusive
+ MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
+ yield
+ }
+ end
+end
+