* add thread local contexts here too.
authorWilfried Göesgens <willi@citadel.org>
Wed, 9 Jun 2010 22:37:37 +0000 (22:37 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 9 Jun 2010 22:37:37 +0000 (22:37 +0000)
citadel/modules/extnotify/extnotify_main.c
citadel/modules/pop3client/serv_pop3client.c

index 1734d088d30013283df8571c74db113c568063c4..c649587f9a405a2ea34bbfeb8a627f65352092c6 100644 (file)
@@ -161,9 +161,11 @@ void create_extnotify_queue(void) {
  */
 void do_extnotify_queue(void) 
 {
+
        NotifyContext Ctx;
        static int doing_queue = 0;
        int i = 0;
+       CitContext extnotifyCC;
     
        /*
         * This is a simple concurrency check to make sure only one queue run
@@ -173,6 +175,10 @@ void do_extnotify_queue(void)
         */
        if (doing_queue) return;
        doing_queue = 1;
+
+       /* Give this thread its own private CitContext */
+       CtdlFillSystemContext(&extnotifyCC, "extnotify");
+       citthread_setspecific(MyConKey, (void *)&extnotifyCC );
     
        /*
         * Go ahead and run the queue
@@ -183,6 +189,7 @@ void do_extnotify_queue(void)
        Ctx.NotifyHostList = GetNotifyHosts();
        if (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
                CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+               CtdlClearSystemContext();
                return;
        }
        CtdlForEachMessage(MSGS_ALL, 0L, NULL,
@@ -213,6 +220,7 @@ void do_extnotify_queue(void)
 
        CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
        doing_queue = 0;
+       CtdlClearSystemContext();
 }
 /*!
  * \brief Process messages in the external notification queue
index 8a0693304611d418ec46e5ebc71ced13cc3f317d..3bc0984833e8491e80dc74118105f701ed0e2a43 100644 (file)
@@ -308,7 +308,12 @@ void pop3client_scan(void) {
        static int doing_pop3client = 0;
        struct pop3aggr *pptr;
        time_t fastest_scan;
-       
+       CitContext popclientCC;
+
+       /* Give this thread its own private CitContext */
+       CtdlFillSystemContext(&popclientCC, "popclient");
+       citthread_setspecific(MyConKey, (void *)&popclientCC );
+
        if (config.c_pop3_fastest < config.c_pop3_fetch)
                fastest_scan = config.c_pop3_fastest;
        else
@@ -346,6 +351,7 @@ void pop3client_scan(void) {
        CtdlLogPrintf(CTDL_DEBUG, "pop3client ended\n");
        last_run = time(NULL);
        doing_pop3client = 0;
+       CtdlClearSystemContext();
 }