Author: Jan Nijtmans <jan.nijtmans@gmail.com>
State: Draft
Type: Project
Vote: Pending
Created: 11-Dec-2017
Post-History:
Keywords: threads
Tcl-Version: 8.7
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:
* On Windows, dde and sockets don't work correctly, as they need threads to operate.
* On UNIX, the new epoll() and kqueue() notifiers (TIP #458) expect the pthread locking to be available.
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.
Proposal
Include the following snippet in tcl.h:
#ifndef TCL_THREADS # define TCL_THREADS 1 #endif
Include the following snippet in tclInt.h:
#if TCL_THREADS && !defined(USE_THREAD_ALLOC) # define USE_THREAD_ALLOC 1 #endif
This means that the (nmake/autoconf) build systems no longer need to explicitely 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 the autoconf build system, remove the --disable-threads option.
In the nmake build system, don't use "t" any longer as suffix, and remove the "nothreads" and "thrdalloc" build options.
In Tcl 9, fully remove the use of TCL_THREADS throughout the whole source code. The value "1" is assumed everywhere. Non-threaded builds are no longer possible.
Implementation
An implementation of this TIP can be found in the tip-491 branch.
Copyright
This document has been placed in the public domain.