Posted to tcl by pooryorick at Thu Apr 05 13:05:04 GMT 2018view raw

  1. coroutine c1 ::apply [list {} {
  2. yield
  3. puts {hello from c1}
  4. main
  5. }]
  6. coroutine main ::apply [list {} {
  7. catch {[yieldto c1]} cres copts
  8. puts {goodbye from main}
  9. puts [list cres is $cres]
  10. }]
  11.  
  12.