Posted to tcl by Poor Yorick at Wed Nov 10 12:39:26 GMT 2021view raw

  1. package require Thread
  2. proc handle_result args {
  3. puts [list {variable is changed} $args]
  4. }
  5. proc threaderror {tid msg} {
  6. puts [list {thread error} $tid $msg]
  7. }
  8. proc main thread {
  9. thread::send -async $thread {
  10. proc bg args {
  11. puts oogah!
  12. puts stderr [list glub! $args]
  13. flush stderr
  14. }
  15. interp bgerror {} bg
  16. puts zoink
  17. }
  18. thread::send -async $thread {error {an error}} a
  19. }
  20. thread::errorproc threaderror
  21. interp create t1
  22. set thread [thread::create]
  23. after 0 [list [namespace which main] $thread]
  24. vwait forever

AltStyle によって変換されたページ (->オリジナル) /