Tcl package Thread source code

View Ticket
Login
Ticket UUID: 2b5e85ab4287d2531d3f4a6366dd82e6aca6a035
Title: [thread::errorproc] is called twice for one error, once for "worker" and once for "main" thread
Type: Bug Version:
Submitter: pooryorick Created on: 2021-11-10 22:40:44
Subsystem: - New Builtin Commands Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2021-11-10 22:43:06
Resolution: None Closed By: nobody
    Closed on:
Description: (text/x-fossil-wiki)
When the following script is evaluated in a core-8-branch build,
<code>threaderror</code> is called twice, once for the "worker" interpreter and
once for the "main" interpreter.  If the variable name (<code>resvar<code> in
this example) is removed, there is only one call to <code>threaderror</code>.
In each case there should be only one call to an error handler.

<code>threaderrorcode</code>

<code><verbatim>
package require Thread
 
proc handle_result args {
    puts [list {variable is changed} $args]
}
 
proc threaderror {tid msg} {
    puts [list {thread error} $tid $msg]
}
 
proc main thread {
    thread::send -async $thread {error {an error}} resvar
}
 
 
thread::errorproc threaderror
interp create t1
set thread [thread::create]
 
after 0 [list [namespace which main] $thread]
 
vwait forever
</verbatim></code>