Posted to tcl by Poor Yorick at Wed Nov 10 11:33:59 GMT 2021view raw

  1. package require Thread
  2.  
  3. proc bg args {
  4. puts [list {main error handler} $args]
  5. }
  6. interp bgerror {} bg
  7.  
  8.  
  9. after 0 {
  10. interp create t1
  11. set thread [thread::create]
  12. thread::send -async $thread {
  13. proc bg args {
  14. puts stderr [list {thread error handler} $args]
  15. flush stderr
  16. }
  17. interp bgerror {} bg
  18. }
  19. thread::send -async $thread {error {an error}} a
  20. }
  21.  
  22. vwait forever
  23.