[Aptitude-svn-commit] r4167 - in branches/aptitude-0.3/aptitude: . src/generic

Daniel Burrows dburrows at costa.debian.org
Thu Sep 22 05:52:14 UTC 2005


Author: dburrows
Date: Thu Sep 22 05:52:08 2005
New Revision: 4167

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/resolver_manager.cc
Log:
Don't hold the instance lock of the resolver manager over arbitrary code; eliminates a deadlock.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Thu Sep 22 05:52:08 2005
@@ -1,5 +1,13 @@
 2005-09-21  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/resolver_manager.cc:
+
+	  Don't hold the lock while calling state_changed().  This avoids
+	  deadlocks if state-changing callbacks trigger code that tries to
+	  grab the instance lock from another thread.  (and just avoids
+	  holding the lock over arbitrary code in general, probably a good
+	  idea)
+
 	* src/ui.cc:
 
 	  Use the new maybe-blocking solution fetching routine.

Modified: branches/aptitude-0.3/aptitude/src/generic/resolver_manager.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/resolver_manager.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/resolver_manager.cc	Thu Sep 22 05:52:08 2005
@@ -278,6 +278,7 @@
   // discard/create pair, and even if we didn't create a new resolver
   // we have to inform the listeners that the old one went away
   // (maybe).
+  l.release();
   state_changed();
 }
 
@@ -715,6 +716,7 @@
   out_of_solutions.take();
   out_of_solutions.put(false);
 
+  l.release();
   state_changed();
 }
 
@@ -748,6 +750,7 @@
   out_of_solutions.take();
   out_of_solutions.put(false);
 
+  l.release();
   state_changed();
 }
 
@@ -781,6 +784,7 @@
   out_of_solutions.take();
   out_of_solutions.put(false);
 
+  l.release();
   state_changed();
 }
 
@@ -811,10 +815,11 @@
 
   resolver->unforce_break(dep);
 
-  state_changed();
-
   out_of_solutions.take();
   out_of_solutions.put(false);
+
+  l.release();
+  state_changed();
 }
 
 bool resolver_manager::is_forced_broken(const aptitude_resolver_dep &dep)
@@ -834,6 +839,7 @@
     selected_solution = solnum;
   sol_l.release();
 
+  l.release();
   state_changed();
 }
 
@@ -846,6 +852,7 @@
     ++selected_solution;
   sol_l.release();
 
+  l.release();
   state_changed();
 }
 
@@ -858,6 +865,7 @@
     --selected_solution;
   sol_l.release();
 
+  l.release();
   state_changed();
 }
 



More information about the Aptitude-svn-commit mailing list