thread::send might send to wrong interp
Closed / Fixed464340ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-09-24 09:13:17
Consider:
set script {
package require Thread
set worker [thread::create {
proc evaluate {cbThread script cbScript} {
thread::send $cbThread\
[list $cbScript [thread::id] [eval $script]]
}
thread::wait
}]
proc callback {thread value} {
set ::continue {}
}
thread::send -async $worker \
"evaluate [thread::id] list callback"
vwait ::continue
puts "$worker done"
}
set interp1 [interp create]
$interp1 eval $script
set interp2 [interp create]
$interp2 eval $script
The interp1 evaluation works fine.
The interp2 evaluation blocks indefinitely.
This is because the callback is executed in the
wrong interpreter. The threading extension
evaluates callbacks always in the main interpreter
i.e. one which was active when the thread was started.
Thanks for Jean-Luc Fontaine for pointing this out.
vasiljevic Closed ticket [464340ffff].
[History diff]2002-01-20 07:28:38
Log in (anonymous is fine) to add a comment.