]> code.citadel.org Git - citadel.git/blobdiff - citadel/threads.c
* Save entire instant message conversations to the message base, instead of one saved...
[citadel.git] / citadel / threads.c
index a24e03289e74121b826d57856c09d63a2d17649c..d67f7dbe99e384a915d8a04ce2daa69da2dff206 100644 (file)
@@ -1,13 +1,16 @@
 /*
- * $Id: sysdep.c 5882 2007-12-13 19:46:05Z davew $
+ * $Id$
  *
  * Citadel "system dependent" stuff.
- * See copyright.txt for copyright information.
+ * See COPYING for copyright information.
  *
  * Here's where we have the Citadel thread implimentation
  *
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
 #include <sys/types.h>
 #include <errno.h>
 #include <sys/socket.h>
@@ -26,6 +29,8 @@
 # endif
 #endif
 
+#include <libcitadel.h>
+
 #include "threads.h"
 #include "ctdl_module.h"
 #include "modules_init.h"
@@ -323,6 +328,9 @@ void ctdl_thread_internal_change_state (CtdlThreadNode *this_thread, enum CtdlTh
  */
 void CtdlThreadStopAll(void)
 {
+       /* First run any registered shutdown hooks.  This probably doesn't belong here. */
+       PerformSessionHooks(EVT_SHUTDOWN);
+
        //FIXME: The signalling of the condition should not be in the critical_section
        // We need to build a list of threads we are going to signal and then signal them afterwards
        
@@ -1096,6 +1104,10 @@ void ctdl_thread_internal_check_scheduled(void)
        CtdlThreadNode *this_thread, *that_thread;
        time_t now;
        
+       /* Don't start scheduled threads if the system wants single user mode */
+       if (CtdlWantSingleUser())
+               return;
+       
        if (try_critical_section(S_SCHEDULE_LIST))
                return; /* If this list is locked we wait till the next chance */