* move initialization of context to the top
authorWilfried Göesgens <willi@citadel.org>
Mon, 7 Jun 2010 22:06:50 +0000 (22:06 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 7 Jun 2010 22:06:50 +0000 (22:06 +0000)
* clean up context on exit

citadel/modules/expire/serv_expire.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/network/serv_network.c
citadel/modules/rssclient/serv_rssclient.c

index ac1a6f8aadf44af7bd38c17f4d34f252c51b2b10..eaae100b38579389b35c6af2b7bd2af2e23f4a2d 100644 (file)
@@ -864,10 +864,9 @@ void *purge_databases(void *args)
         struct tm tm;
        struct CitContext purgerCC;
 
-       CtdlLogPrintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
-
        CtdlFillSystemContext(&purgerCC, "purger");
        citthread_setspecific(MyConKey, (void *)&purgerCC );
+       CtdlLogPrintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
 
         while (!CtdlThreadCheckStop()) {
                 /* Do the auto-purge if the current hour equals the purge hour,
@@ -945,6 +944,7 @@ void *purge_databases(void *args)
                        CtdlLogPrintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
 
         }
+       CtdlClearSystemContext();
         return NULL;
 }
 /*****************************************************************************/
index 1e461a152785676bc3c2539bb32d188b942db066..f6266e9c4095723b9dded129406a1387c639c12b 100644 (file)
@@ -374,10 +374,10 @@ void do_fulltext_indexing(void) {
 void *indexer_thread(void *arg) {
        struct CitContext indexerCC;
 
-       CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() initializing\n");
 
        CtdlFillSystemContext(&indexerCC, "indexer");
        citthread_setspecific(MyConKey, (void *)&indexerCC );
+       CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() initializing\n");
 
        while (!CtdlThreadCheckStop()) {
                do_fulltext_indexing();
@@ -385,6 +385,7 @@ void *indexer_thread(void *arg) {
        }
 
        CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() exiting\n");
+       CtdlClearSystemContext();
        return NULL;
 }
 
index 9ed349bab54399b19552441ad3dba0db8c985b25..b3d3d4617300430a06a41abc62813c794fa1885a 100644 (file)
@@ -2232,6 +2232,7 @@ void *network_do_queue(void *args) {
         * with a static variable instead.
         */
        if (doing_queue) {
+               CtdlClearSystemContext();
                return NULL;
        }
        doing_queue = 1;
@@ -2319,6 +2320,7 @@ void *network_do_queue(void *args) {
        else {
                CtdlLogPrintf(CTDL_DEBUG, "network: Task STOPPED.\n");
        }
+       CtdlClearSystemContext();
        return NULL;
 }
 
index de4c48cfc66807f00a78449b9cd87d5ce8c09843..c69f6b4ad44f36340033c1b7e1c97480780335bb 100644 (file)
@@ -902,6 +902,7 @@ void *rssclient_scan(void *args) {
                CtdlThreadSchedule ("RSS Client", CTDLTHREAD_BIGSTACK, rssclient_scan, NULL, last_run + config.c_net_freq);
        else
                CtdlLogPrintf(CTDL_DEBUG, "rssclient: Task STOPPED.\n");
+       CtdlClearSystemContext();
        return NULL;
 }