rem: Ns_CondBroadcast(&queuePtr->cond);
context: JobThread(void *arg){    Tcl_Interp          *interp;    Job                 *jobPtr;    char                buf[100];    CONST char          *err;    Queue               *queuePtr;    Tcl_HashEntry       *jPtr;    Ns_WaitForStartup();    Ns_MutexLock(&tp.queuelock);    snprintf(buf, 100, "-ns_job_%x-", tp.nextThreadId++);    Ns_ThreadSetName(buf);    Ns_Log(Notice, "Starting thread: %s", buf);    while (1) {	++tp.nidle;	while (((jobPtr = getNextJob()) == NULL) &&               !(tp.req == THREADPOOL_REQ_STOP)) {	    Ns_CondWait(&tp.cond, &tp.queuelock);	}	--tp.nidle;        if (tp.req == THREADPOOL_REQ_STOP) {            break;        }        /*         * Run the job.         */        Ns_MutexUnlock(&tp.queuelock);        interp = Ns_TclAllocateInterp(jobPtr->server);        Ns_GetTime(&jobPtr->endTime);        Ns_GetTime(&jobPtr->startTime);        jobPtr->code = Tcl_EvalEx(interp, jobPtr->script.string, -1, 0);                /*         * Save the results.         */        Tcl_DStringAppend(&jobPtr->results, Tcl_GetStringResult(interp), -1);        err = Tcl_GetVar(interp, "errorCode", TCL_GLOBAL_ONLY);        if (err != NULL) {            jobPtr->errorCode = ns_strdup(err);        }        err = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);        if (err != NULL) {            jobPtr->errorInfo = ns_strdup(err);        }        Ns_GetTime(&jobPtr->endTime);        Ns_TclDeAllocateInterp(interp);                Ns_MutexLock(&tp.queuelock);                    assert(LookupQueue(NULL, jobPtr->queueId, &queuePtr, 1) == TCL_OK);        --(queuePtr->nRunning);        jobPtr->state = JOB_DONE;        /*         * Clean any cancelled or detached jobs.         */        if ((jobPtr->req == JOB_CANCEL) || (jobPtr->type == JOB_DETACHED)) {            jPtr = Tcl_FindHashEntry(&queuePtr->jobs, Tcl_DStringValue(&jobPtr->id));            Tcl_DeleteHashEntry(jPtr);            FreeJob(jobPtr);        }        ReleaseQueue(queuePtr, 1);        Ns_CondBroadcast(&queuePtr->cond);    }    --tp.nthreads;    Ns_CondBroadcast(&tp.cond);    Ns_MutexUnlock(&tp.queuelock);    Ns_Log(Notice, "exiting");}