[JDEV] [patch mtq.c]

Rodolphe Duge de Bernonville rod at idealx.com
Mon Feb 19 11:23:33 CST 2001


It seems mtq.c has a little problem ...
so all the threads of the pool become busy very quickly :

here is a little patch :


@@ -243,5 +361,37 @@
         pth_msgport_put(mp, (pth_message_t *)c);
         q->routed = 1;
     }
+    /* if the queue has already been routed (yes, this can happen...)
*/
+    else if (n < MTQ_THREADS)
+    {
+	mtq__master->all[n]->busy = 0;
+    }
 }



if we have found a not busy thread to work ...

you could also do this just before the


    for(n = 0; n < MTQ_THREADS; n++)
        if(mtq__master->all[n]->busy == 0)
        {
            mp = mtq__master->all[n]->mp;
            mtq__master->all[n]->busy = 1;
            break;
        }

to avoid scanning this list ....




More information about the JDev mailing list