Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-10-18
10:28 • Closed ticket [dbafd8235c]: coroutine, vwait, and try == no background error han... artifact: a58b4ea2ee user: sebres
08:40 • New ticket [dbafd8235c]. artifact: 043c6eb52c user: pooryorick

coroutine, vwait, and try == no background error handler

Closed / Invaliddbafd8235cf752602e7404bbbb5c1201d1d167faCreated 2 years agoUpdated 2 years ago
Descriptionwiki2024-10-18 08:40:19
In the following script, the background error handler is not invoked.

proc p1 {} {
	error {error 1}
}

after 0 [list coroutine c1 ::apply [list {} {
	variable done
	try p1 finally {
		set done 1
	}
	error {error 2}
} [namespace current]]]

vwait done
sebreswiki2024-10-18 10:28:01

This is expected behaviour - since done is set (in finally), vwait will stop before the idle event of background error takes place. This has nothing to do with coro, NRE etc - it is simply how vwait (and background error handler) work.

Simplified example illustrating this:

% after 0 { set done 1; error test }; vwait done
% update
test
    while executing
"error test "
    ("after" script)

Log in (anonymous is fine) to add a comment.