Mainapp: properly remove thread hook when last thread is removed
authorTim Niemueller <niemueller@kbsg.rwth-aachen.de>
Sun, 31 Jan 2010 15:08:17 +0000 (16:08 +0100)
committerTim Niemueller <niemueller@kbsg.rwth-aachen.de>
Sun, 31 Jan 2010 15:17:28 +0000 (16:17 +0100)
In the thread manager's thread map a hook was not removed when the
last thread was removed for that hook. This caused the main loop to
not pause when the last timed thread was gone, rendering the
power saving defeated after a load/unload cycle, for which this was
implemented.

src/mainapp/thread_manager.cpp

index d598e7b..fe7638c 100644 (file)
@@ -185,6 +185,7 @@ FawkesThreadManager::internal_remove_thread(Thread *t)
     BlockedTimingAspect::WakeupHook hook = timed_thread->blockedTimingAspectHook();
     if ( threads.find(hook) != threads.end() ) {
       threads[hook].remove_locked(t);
+      if (threads[hook].empty())  threads.erase(hook);
     }
   } else {
     untimed_threads.remove_locked(t);