[Aptitude-svn-commit] r4101 - in branches/aptitude-0.3/aptitude: .
src/generic
Daniel Burrows
dburrows at costa.debian.org
Fri Sep 16 22:00:04 UTC 2005
Author: dburrows
Date: Fri Sep 16 22:00:00 2005
New Revision: 4101
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/resolver_manager.cc
Log:
Don't segfault or deadlock when shutting down the resolver thread if the resolver was discarded.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Fri Sep 16 22:00:00 2005
@@ -1,3 +1,19 @@
+2005-09-16 Daniel Burrows <dburrows at debian.org>
+
+ * src/generic/resolver_manager.cc:
+
+ Make a thread-kill override all other control messages, so that
+ the program doesn't deadlock trying to shut the background
+ thread down. What would happen was that if, e.g., the resolver
+ was null and the foreground thread tried to kill the background
+ thread, the background thread would sit there waiting for the
+ resolver to be non-null.
+
+ * src/generic/resolver_manager.cc:
+
+ Fix a segfault that occurred when shutting down the resolver
+ thread.
+
2005-09-15 Daniel Burrows <dburrows at debian.org>
* src/generic/problemresolver/Makefile.am:
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 Fri Sep 16 22:00:00 2005
@@ -100,8 +100,8 @@
while(1)
{
- while(background_thread_suspend_count > 0 || resolver_null ||
- (!background_thread_killed && pending_jobs.empty()))
+ while((background_thread_suspend_count > 0 || resolver_null || pending_jobs.empty()) &&
+ !background_thread_killed)
background_control_cond.wait(l);
if(background_thread_killed)
@@ -173,7 +173,8 @@
{
threads::mutex::lock control_lock(background_control_mutex);
- resolver->cancel_solver();
+ if(resolver != NULL)
+ resolver->cancel_solver();
background_thread_killed = true;
background_control_cond.wake_all();
@@ -204,7 +205,8 @@
threads::mutex::lock control_lock(background_control_mutex);
- resolver->cancel_solver();
+ if(resolver != NULL)
+ resolver->cancel_solver();
++background_thread_suspend_count;
background_control_cond.wake_all();
@@ -212,7 +214,8 @@
while(background_thread_in_resolver)
background_resolver_cond.wait(control_lock);
- resolver->uncancel_solver();
+ if(resolver != NULL)
+ resolver->uncancel_solver();
}
void resolver_manager::unsuspend_background_thread()
More information about the Aptitude-svn-commit
mailing list