Author: Donal K. Fellows <[email protected]> State: Final Type: Project Tcl-Version: 8.6 Vote: Done Post-History: Created: 19-Mar-2010 Keywords: Tcl
This TIP changes the the default configuration for building to threaded on all platforms where this is not already the case (primarily Unix other than MacOS X) and adds the Thread package to the set of packages included by default.
As the world of hardware changes, it is becoming clear that modern computers will increasingly have multiple CPU cores available to them. This is driven by the fact that it is easier for the manufacturers of processors to make them able to do more by increasing the number of cores than by increasing the speed of those cores. It is therefore a strongly-desirable thing to have Tcl able to utilize these resources and, naturally, in a cross-platform way.
Threading is actually an area of considerable strength for Tcl. In particular, we have supported a threaded build of Tcl on all platforms since Tcl 8.1, and the performance cost of this is now minimal. In addition, the Thread package has been in use in production for a long time and provides script-level access to threading facilities. All that we need to do to fully enable Tcl 8.6 for threading for all scripts is to make the Thread package into a standard contributed package and ensure that it can be used on all our main supported platforms. It is this which this TIP proposes.
All that is required is to make the Thread package into one of the packages that is handled through the contributed package mechanism (c.f., [incr Tcl] , TDBC ), by locating a copy of it in the pkgs/ directory of the Tcl sources. However, to make this meaningful it is also necessary to alter the default configuration of Tcl to be threaded. This will have no effect on Windows and OSX, where threaded configurations are default anyway, but will have an impact on other Unixes (Linux, Solaris, etc.) The threaded configuration has had extensive testing over many years on all platforms, so it is known that a majority of Tcl scripts will be wholly unaffected by this.
The main issues arising from this relate to the Expect and TclX packages. This is because they make fork and signal commands available; these APIs are troublesome because of how they interact with Tcl's notifier and the POSIX Thread system in general. However, the importance of threading as a general facility means that it is going to be more important to alter those packages than to keep Tcl defaulting to unthreaded.
This document has been placed in the public domain.