commit 93b6b49018ea00b8c7503fb4dccf1abdecf37044
parent 3ee44ab0bc39f3669cc4025807d129725104cd46
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Fri, 23 Nov 2007 22:22:10 +0000
slight betterification of Recoverable
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@709 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git 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