summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--prelude.rb11
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 975195967a3..ae163edd20a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Aug 25 10:05:17 2007 Koichi Sasada <ko1@atdot.net>
+
+ * prelude.rb: add Thread.exclusive. This class method
+ is different from 1.8's. Thread.exclusive only does
+ synchronize with VM global mutex.
+
Sat Aug 25 09:39:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_s_try_convert): more document description.
diff --git a/prelude.rb b/prelude.rb
index 6451b8f74ae..8ce306caa29 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
+