TIP 134: Subsystem Per-Thread Data Interfaces

Bounty program for improvements to Tcl and certain Tcl packages.
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Author:         Colin McCormack <[email protected]>
State:          Withdrawn
Type:           Project
Vote:           Pending
Created:        12-May-2003
Tcl-Version:    8.5


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 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.