rem: detached = STREQ(argv[1], "begindetached"); CreateTclThread(itPtr, argv[2], detached, &tid); SetAddr(interp, 't', tid);
add: if (STREQ(argv[1], "begindetached")) { CreateTclThread(itPtr, argv[2], 1, NULL); } else { CreateTclThread(itPtr, argv[2], 0, &tid); SetAddr(interp, 't', tid); }
context: NsTclThreadCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv){    NsInterp *itPtr = arg;    void *status;    Ns_Thread tid;    int detached;    if (argc < 2) {        Tcl_AppendResult(interp, "wrong # args: should be \"",            argv[0], " command arg\"", NULL);        return TCL_ERROR;    }    if (STREQ(argv[1], "begin") || STREQ(argv[1], "create") ||	STREQ(argv[1], "begindetached")) {        if (argc < 3) {            Tcl_AppendResult(interp, "wrong # args: should be \"",                argv[0], " ", argv[1], " script\"", NULL);            return TCL_ERROR;        }	detached = STREQ(argv[1], "begindetached");	CreateTclThread(itPtr, argv[2], detached, &tid);        SetAddr(interp, 't', tid);    } else if (STREQ(argv[1], "wait") || STREQ(argv[1], "join")) {        if (argc < 3) {            Tcl_AppendResult(interp, "wrong # args: should be \"",                argv[0], " ", argv[1], " tid\"", NULL);            return TCL_ERROR;        }        if (GetAddr(interp, 't', argv[2], (void **) &tid) 	    != TCL_OK) {            return TCL_ERROR;        }	Ns_ThreadJoin(&tid, &status);	Tcl_SetResult(interp, (char *) status, (Tcl_FreeProc *) ns_free);    } else if (STREQ(argv[1], "get")) {        Ns_ThreadSelf(&tid);        SetAddr(interp, 't', tid);    } else if (STREQ(argv[1], "getid") || STREQ(argv[1], "id")) {	Tcl_SetObjResult(interp, Tcl_NewIntObj(Ns_ThreadId()));    } else if (STREQ(argv[1], "name")) {	if (argc > 2) {	    Ns_ThreadSetName(argv[2]);	}	Tcl_SetResult(interp, Ns_ThreadGetName(), TCL_VOLATILE);    } else if (STREQ(argv[1], "yield")) {        Ns_ThreadYield();    } else {        Tcl_AppendResult(interp, "unknown command \"",            argv[1], "\":  should be begin, begindetached, create "            "get, getid, id, join, wait, or yield", NULL);        return TCL_ERROR;    }    return TCL_OK;}