add: poolPtr->name = NULL;
context: static PoolFunc WaitPool;static void IteratePools(PoolFunc *func, void *arg);static int AppendPool(Tcl_Interp *interp, char *key, int val);static int PoolResult(Tcl_Interp *interp, Pool *poolPtr);static int GetPool(Tcl_Interp *interp, Tcl_Obj *objPtr, Pool **poolPtrPtr);/* * Static variables defined in this file. */static int            poolid;static Pool           defpool;static Tcl_HashTable  pools;/* *---------------------------------------------------------------------- * * NsInitPools -- * *  Init thread pools. * * Results: *  None. * * Side effects: *  None. * *---------------------------------------------------------------------- */voidNsInitPools(void){    Tcl_HashEntry *hPtr;    int new;    poolid = Ns_UrlSpecificAlloc();    Tcl_InitHashTable(&pools, TCL_STRING_KEYS);    InitPool(&defpool);    defpool.name = ns_strdup("default");    hPtr = Tcl_CreateHashEntry(&pools, "default", &new);    if (new) {        Tcl_SetHashValue(hPtr, &pools);    }}Pool *NsGetPool(char *server, char *method, char *url){    Pool *poolPtr;    poolPtr = Ns_UrlSpecificGet(server, method, url, poolid);    if (poolPtr == NULL) {        poolPtr = &defpool;    }    return poolPtr;}/* *---------------------------------------------------------------------- * * InitPool -- * *  Initialize a connection pool structure with defaults. * * Results: *  None. * * Side effects: *  None. * *---------------------------------------------------------------------- */static voidInitPool(Pool *poolPtr){    memset(poolPtr, 0, sizeof(Pool));    Ns_MutexInit(&poolPtr->lock);    Ns_CondInit(&poolPtr->cond);    poolPtr->threads.min = 0;           poolPtr->threads.max = 10;          poolPtr->threads.timeout = 120; /* NB: Exit after 2 minutes idle. */    poolPtr->threads.maxconns = 0;  /* NB: Never exit thread. */}voidNsStartPools(void){    IteratePools(StartPool, NULL);}voidNsStopPools(Ns_Time *timePtr){    IteratePools(StopPool, NULL);    IteratePools(WaitPool, timePtr);}static voidStartPool(Pool *poolPtr, void *ignored){    int i;    poolPtr->threads.current = poolPtr->threads.idle = poolPtr->threads.min;    for (i = 0; i < poolPtr->threads.min; ++i) {        NsCreateConnThread(poolPtr);    }}static voidStopPool(Pool *poolPtr, void *ignored){    Ns_MutexLock(&poolPtr->lock);    poolPtr->shutdown = 1;    Ns_CondBroadcast(&poolPtr->cond);    Ns_MutexUnlock(&poolPtr->lock);}static voidWaitPool(Pool *poolPtr, void *arg){    Ns_Time *timePtr = arg;    int status;        status = NS_OK;    Ns_MutexLock(&poolPtr->lock);    while (status == NS_OK &&            (poolPtr->queue.wait.firstPtr != NULL ||             poolPtr->threads.current > 0)) {        status = Ns_CondTimedWait(&poolPtr->cond, &poolPtr->lock, timePtr);    }    if (status != NS_OK) {        Ns_Log(Warning, "timeout waiting for connection thread exit");    }}