]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Fix some save/quit/rescan races
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 5 Aug 2006 12:20:46 +0000 (12:20 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 5 Aug 2006 12:20:46 +0000 (12:20 +0000)
lib/rbot/ircbot.rb
lib/rbot/plugins.rb

index d83a5fe4152c780d1b9dadc8f1aef855c48a61a3..f5250b9b8c73916a1044b3e894c46e9e83f989f6 100644 (file)
@@ -809,7 +809,9 @@ class IrcBot
       debug "Saving"
       save
       debug "Cleaning up"
-      @plugins.cleanup
+      @save_mutex.synchronize do
+        @plugins.cleanup
+      end
       # debug "Closing registries"
       # @registry.close
       debug "Cleaning up the db environment"
@@ -848,8 +850,10 @@ class IrcBot
 
   # call the rescan method for all of the botmodules
   def rescan
-    @lang.rescan
-    @plugins.rescan
+    @save_mutex.synchronize do
+      @lang.rescan
+      @plugins.rescan
+    end
   end
 
   # channel:: channel to join
index b55fbe4a115d559b277a305571428225bc8f9a2e..848240cffcb5cd7fb7ddda0268c487082cda126a 100644 (file)
@@ -417,9 +417,7 @@ module Plugins
 
     # call the cleanup method for each active plugin
     def cleanup
-      @bot.save_mutex.synchronize do
-        delegate 'cleanup'
-      end
+      delegate 'cleanup'
       reset_botmodule_lists
     end