Tcl package Thread source code

View Ticket
Login
2021-11-10
22:43 Ticket [2b5e85ab42] :errorproc is called twice for one error, once for "worker" and once for "main" thread status still Open with 3 other changes artifact: c9e48c8dec user: pooryorick
22:40 New ticket [2b5e85ab42]. artifact: 61a0dad8fb user: pooryorick

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:

When the following script is evaluated in a core-8-branch build, threaderror is called twice, once for the "worker" interpreter and once for the "main" interpreter. If the variable name (resvar in this example) is removed, there is only one call to threaderror. In each case there should be only one call to an error handler.

threaderrorcode

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