add: Ns_MutexInit(&modPtr->lock); Ns_MutexSetName2(&modPtr->lock, "nscgi", server);
context: Ns_ModuleInit(char *server, char *module){    char           *path, *key, *value, *section;    int             i;    Ns_Set         *set;    Ns_DString      ds;    Mod	   *modPtr;    static int	    initialized;    /*     * On the first (and likely only) load, register     * the temp file cleanup routine and open /dev/null     * for requests without content data.     */    if (!initialized) {	devNull = open("/dev/null", O_RDONLY);	if (devNull < 0) {	    Ns_Log(Error, "nscgi: open(/dev/null) failed: %s", strerror(errno));	    return NS_ERROR;	}	Ns_DupHigh(&devNull);	Ns_CloseOnExec(devNull);	initialized = 1;    }    /*     * Config basic options.     */    path = Ns_ConfigGetPath(server, module, NULL);    modPtr = ns_calloc(1, sizeof(Mod));    modPtr->module = module;    modPtr->server = server;    if (!Ns_ConfigGetInt(path, "maxinput", &modPtr->maxInput)) {        modPtr->maxInput = DEFAULT_MAXINPUT;    }    if (!Ns_ConfigGetInt(path, "limit", &modPtr->maxCgi)) {        modPtr->maxCgi = 0;    }    if (!Ns_ConfigGetInt(path, "maxwait", &modPtr->maxWait)) {        modPtr->maxWait = 30;    }    if (!Ns_ConfigGetBool(path, "gethostbyaddr", &i)) {        i = 0;    }    if (i) {	modPtr->flags |= CGI_GETHOST;    }    /*     * Configure the various interp and env options.     */    Ns_DStringInit(&ds);    section = Ns_ConfigGetValue(path, "interps");    if (section != NULL) {        Ns_DStringVarAppend(&ds, "ns/interps/", section, NULL);        modPtr->interps = Ns_ConfigGetSection(ds.string);        if (modPtr->interps == NULL) {            Ns_Log(Warning, "nscgi: no such interps section: %s",		   ds.string);        }    	Ns_DStringTrunc(&ds, 0);    }    section = Ns_ConfigGetValue(path, "environment");    if (section != NULL) {        Ns_DStringVarAppend(&ds, "ns/environment/", section, NULL);        modPtr->mergeEnv = Ns_ConfigGetSection(ds.string);        if (modPtr->mergeEnv == NULL) {            Ns_Log(Warning, "nscgi: no such environment section: %s",		   ds.string);        }    	Ns_DStringTrunc(&ds, 0);    }    if (!Ns_ConfigGetBool(path, "systemenvironment", &i)) {        i = 0;    }    if (i) {	modPtr->flags |= CGI_SYSENV;    }    /*     * Register all requested mappings.     */    set = Ns_ConfigGetSection(path);    for (i = 0; set != NULL && i < Ns_SetSize(set); ++i) {        key = Ns_SetKey(set, i);        value = Ns_SetValue(set, i);        if (STRIEQ(key, "map")) {            CgiRegister(modPtr, value);        }    }    Ns_DStringFree(&ds);    return NS_OK;}