From 93b6b49018ea00b8c7503fb4dccf1abdecf37044 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Fri, 23 Nov 2007 22:22:10 +0000 Subject: [PATCH] slight betterification of Recoverable git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@709 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- lib/sup/util.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 6c8673c..a402ed8 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -501,13 +501,16 @@ class Recoverable def initialize o @o = o @e = nil + @mutex = Mutex.new end def clear_error!; @e = nil; end def has_errors?; !@e.nil?; end def error; @e; end - def method_missing m, *a, &b; __pass m, *a, &b; end + def method_missing m, *a, &b + @mutex.synchronize { __pass m, *a, &b } + end def id; __pass :id; end def to_s; __pass :to_s; end @@ -520,7 +523,7 @@ class Recoverable begin @o.send(m, *a, &b) rescue Exception => e - @e = e + @e ||= e raise e end end -- 2.45.2