\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#134: Subsystem Per-Thread Data Interfaces}
\date{May 12, 2003}
\author{Colin McCormack}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#134}&\textbf{Subsystem Per-Thread Data Interfaces}\\\hline
Author&

Colin McCormack \tipmail{colin}{sharedtech.dyndns.org}
\\
Created&Monday, \(\text{12}^{\text{th}}\) May 2003\\
Type&Project\\
Tcl Version&\(8.5\)\\
State&Withdrawn\\
Vote&Pending\\
Version&\tipversion$Revision: 1.4 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

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.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{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.

\section{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.

\section{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 \textit{tclTSD\tiplangle{}subsystem\tiprangle{}} returning pointer to its TSD. This API should be conditionally compiled, so that it's clear that it's not available to normal extensions.

\section{Implementation}

The implementation of this TIP is trivial.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
