Multithreaded Tcl - Thread Local Storage
Next, various global data had to be moved to thread local storage, e.g., from tclIO.c:
Tcl_SetStdChannel(channel, type)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->stdinInitialized = 1;
tsdPtr->stdinChannel = channel;