TIP 491: Threading Support: phasing out non-threaded builds

Login
Author:         Jan Nijtmans <jan.nijtmans@gmail.com>
State:          Final
Type:           Project
Vote:           Done
Created:        11-Dec-2017
Post-History:
Keywords:       threads
Tcl-Version:    8.7
Tcl-Branch:     tip-491

Abstract

Since TIP #364 proposed improving thread support, time has come to gradually phase out non-threaded builds on all platforms. On Windows and MacOSX, there are known problems on non-threaded build. But also on UNIX it is becoming increasingly difficult to support both threaded and non-threaded builds. This TIP proposes a gradual deprecation and removal of support for non-threaded builds.

Rationale

Non-threaded builds have a number of known problems:

Further on, the nmake build system uses a different suffix, t, than the autoconf-based build system, a historical mistake that cannot be corrected in a patch release. Let's correct that in Tcl 8.7.

A common misconception is that non-threaded builds are necessary to make vfork() and/or signals work correctly. That may have been true in the past, but not any more: vfork() works fine in threaded builds, the only caveat is that threads started before the vfork don't survive the fork. So, as long as new threads are created after doing the fork, everything should work fine. Applications like AOLserver use this already.

If the developers of Tcl itself can count on threading facilities as part of the foundation, they can be free to use threads when useful in writing the code of the Tcl library itself, without being bound to also invent a thread-free version to cover the --disable-threads configuration.

Proposal

This means that the (nmake/autoconf) build systems no longer need to explicitly set those two options, a threaded build will be the default. Non-threaded builds are still possible, adding the flag -DTCL_THREADS=0 to the Makefile. Hopefully this further discourages non-threaded builds.

In Tcl 9:

Implementation

An implementation of this TIP can be found in the tip-491 branch.

Copyright

This document has been placed in the public domain.