TIP #134: Subsystem Per-Thread Data Interfaces

Title:Subsystem Per-Thread Data Interfaces
Version:$Revision: 1.4 $
Author:Colin McCormack <colin at sharedtech dot dyndns dot org>
Created:Monday, 12 May 2003


Tcl core subsystems per-thread data is good, because it modularises the core. None of the structures or access keys are exported, which is bad, because it makes modification to these subsystems difficult in a CVS world.


If one wishes to track the CVS while writing modifications to core subsystems one needs to minimally impact the existing source files while adding or changing subsystem functionality. Since most subsystem global state is kept in Thread Specific Data, and access to this state is necessary for subsystem modifications, providing an interface would ease coding at the core subsystem level. Modular encapsulation would be preserved by conditionally compiling API elements useful only to subsystem development and not intended for extension development.


The degree of modularity of the core would remain unchanged, access to subsystem TSD would presumably only be used for subsystem development, but would enable that development to proceed more easily - one could extend subsystems as easily as one currently writes extensions. I think the degree of potential abuse is likely to be low.

Outline of Proposal

Each Thread Specific Data structure should be named uniquely for each subsystem.

Each subsystem should have its own .h header file

Each subsystem should export a function like tclTSD<subsystem> returning pointer to its TSD. This API should be conditionally compiled, so that it's clear that it's not available to normal extensions.


The implementation of this TIP is trivial.


This document has been placed in the public domain.

Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows