Posted to tcl by schelte at Mon Jun 28 09:03:53 GMT 2010view raw

  1. set code {
  2. puts before
  3. wait 2000
  4. puts after
  5. }
  6.  
  7. interp create foo
  8. foo alias wait wait
  9.  
  10. proc wait {time} {
  11. after $time [info coroutine]
  12. yield
  13. }
  14.  
  15. coroutine main foo eval $code
  16.  
  17. after 2500 exit
  18. vwait forever
  19.  
  20. # Error: cannot yield: C stack busy
  21.  
  22.