]> git.cworth.org Git - sup/commitdiff
yet more better intra-saving exception resilience
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 13 Jun 2007 00:39:33 +0000 (00:39 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 13 Jun 2007 00:39:33 +0000 (00:39 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@451 5c8cc53c-5e98-4d25-b20a-d8db53a31250

bin/sup
lib/sup.rb
lib/sup/util.rb

diff --git a/bin/sup b/bin/sup
index 3892016643b97d7399f9e0d8e7240458e2b5537d..f1d209d61aafad12b07c234d4804c3315a5ad15d 100644 (file)
--- a/bin/sup
+++ b/bin/sup
@@ -254,8 +254,8 @@ rescue Exception => e
   $exception ||= e
 ensure
   unless $opts[:no_threads]
-    PollManager.stop
-    SuicideManager.stop
+    PollManager.stop if PollManager.instantiated?
+    SuicideManager.stop if PollManager.instantiated?
     Index.stop_lock_update_thread
   end
 
index b07ee411197cdab78499438a042a1038baac2bcd..b7c8f0212c6d18713abfe65502e5b80d20798f20 100644 (file)
@@ -104,7 +104,6 @@ module Redwood
   end
 
   def finish
-    Redwood::PollManager.stop
     Redwood::LabelManager.save if Redwood::LabelManager.instantiated?
     Redwood::ContactManager.save if Redwood::ContactManager.instantiated?
     Redwood::PersonManager.save if Redwood::PersonManager.instantiated?
index 8f6680e6eeaa58a065f38d6b7b7e6c6a439defef..c2dd4b02071518c3ba8ba18b3f50709e72748568 100644 (file)
@@ -310,6 +310,13 @@ module Singleton
     def deinstantiate!; @instance = nil; end
     def method_missing meth, *a, &b
       raise "no instance defined!" unless defined? @instance
+
+      ## if we've been deinstantiated, just drop all calls. this is
+      ## useful because threads that might be active during the
+      ## cleanup process (e.g. polling) would otherwise have to
+      ## special-case every call to a Singleton object
+      return nil if @instance.nil?
+
       @instance.send meth, *a, &b
     end
     def i_am_the_instance o