TIP 134: Subsystem Per-Thread Data Interfaces

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Author:         Colin McCormack <colin@sharedtech.dyndns.org>
State:          Withdrawn
Type:           Project
Vote:           Pending
Created:        12-May-2003
Post-History:   
Tcl-Version:    8.5

Abstract

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.

Rationale

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.

Justification

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.

Implementation

The implementation of this TIP is trivial.

Copyright

This document has been placed in the public domain.

History