summaryrefslogtreecommitdiffstats
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
commit062316ca20afc79eac8f99ce9c43193e747f2605 (patch)
treea48f154672e560c0c0fbc5d01c6c193588a012d0
parent84d5d27ed0c25d876a3795879471bf13eec86f49 (diff)
downloadruby-062316ca20afc79eac8f99ce9c43193e747f2605.tar.gz
ruby-062316ca20afc79eac8f99ce9c43193e747f2605.tar.xz
ruby-062316ca20afc79eac8f99ce9c43193e747f2605.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--prelude.rb11
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 975195967..ae163edd2 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 6451b8f74..8ce306caa 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
+