From c289cf3a1ffa71217e597df051d945ff24126379 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 25 Aug 2007 01:09:08 +0000 Subject: [PATCH] * 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 --- ChangeLog | 6 ++++++ prelude.rb | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 975195967a..ae163edd20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Aug 25 10:05:17 2007 Koichi Sasada + + * 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 * array.c (rb_ary_s_try_convert): more document description. 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 +