]> code.citadel.org Git - citadel.git/blobdiff - citadel/housekeeping.c
The thread doing housekeeping now changes its name when doing
[citadel.git] / citadel / housekeeping.c
index 8d65e0ec7b10792e31b86673c7154d11a29518e5..901dd8ec8bfda23b29aab9f4b83e990ed51df21a 100644 (file)
@@ -139,9 +139,8 @@ void do_housekeeping(void) {
        int do_housekeeping_now = 0;
        int do_perminute_housekeeping_now = 0;
        time_t now;
+       const char *old_name;
 
-       CtdlThreadPushName("do_housekeeping");
-       
        /*
         * We do it this way instead of wrapping the whole loop in an
         * S_HOUSEKEEPING critical section because it eliminates the need to
@@ -160,7 +159,6 @@ void do_housekeeping(void) {
        end_critical_section(S_HOUSEKEEPING);
 
        if (do_housekeeping_now == 0) {
-               CtdlThreadPopName();
                return;
        }
 
@@ -170,13 +168,16 @@ void do_housekeeping(void) {
         */
 
        /* First, do the "as often as needed" stuff... */
+       old_name = CtdlThreadName("House Keeping - Journal");
        JournalRunQueue();
 
+       CtdlThreadName("House Keeping - EVT_HOUSE");
        PerformSessionHooks(EVT_HOUSE); /* perform as needed housekeeping */
 
        /* Then, do the "once per minute" stuff... */
        if (do_perminute_housekeeping_now) {
                cdb_check_handles();                    /* suggested by Justin Case */
+               CtdlThreadName("House Keeping - EVT_TIMER");
                PerformSessionHooks(EVT_TIMER);         /* Run any timer hooks */
        }
 
@@ -184,5 +185,5 @@ void do_housekeeping(void) {
         * All done.
         */
        housekeeping_in_progress = 0;
-       CtdlThreadPopName();
+       CtdlThreadName(old_name);
 }