Skip to content
Tcl Source Code View Ticket
Login

View Ticket

exit in thread crashes tclsh

Closed / Wont Fix1538926fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-08-11 20:06:30
When executing the following code in a thread enabled 
tclsh, the tclsh crashes on an access violation on 
Windows XP

package require Thread
thread::send [thread::create] exit

Some information:

% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine)   = intel
tcl_platform(os)        = Windows NT
tcl_platform(osVersion) = 5.1
tcl_platform(platform)  = windows
tcl_platform(threaded)  = 1
tcl_platform(user)      = mjanssen
tcl_platform(wordSize)  = 4
% puts $tcl_version
8.4
% puts $tcl_patchLevel
8.4.13
mpc_janssenplain2006-08-12 06:12:30
Logged In: YES 
user_id=1463011

Further testing shows that in a threaded Tcl8.5a4 it works:

C:\Tcl85\bin>tclsh85t.exe
% parray tcl_platform
tcl_platform(byteOrder) = littleEndian
tcl_platform(machine)   = intel
tcl_platform(os)        = Windows NT
tcl_platform(osVersion) = 5.1
tcl_platform(platform)  = windows
tcl_platform(threaded)  = 1
tcl_platform(user)      = mjanssen
tcl_platform(wordSize)  = 4
% exit

C:\Tcl85\bin>tclsh85t.exe
% package require Thread
2.6.3
% thread::send [thread::create] exit
target thread died
%
C:\Tcl85\bin>
dkf Ticket [1538926fff]: 1 change [History diff]2006-08-14 15:57:20
vasiljevicplain2006-08-14 16:07:28
Logged In: YES 
user_id=95086

Calling [exit] out of the non-startup thread is NOT supported with the 
current state of the Tcl library. You must make sure all your threads
are gone before attempting the [exit]. And you can attempt to call 
the [exit] only from the first (startup) therad in the process.
The fact that you got it to work in 8.5 is purely a coincidence. 
This cannot be solved easily w/o re-designing how the Tcl library
handles various system's teardown.
cc_bennyplain2006-08-15 00:37:44
Logged In: YES 
user_id=143885

Tcl shouldn't crash, though, I think.  It should raise an
error.  The error message should explain what was wrong,
so that the coder knows how to fix it.
Log in (anonymous is fine) to add a comment.