Posted to tcl by aspect at Thu Dec 24 03:22:33 GMT 2015view raw

  1. proc coEvery {option args} {
  2. coroutine Create#[incr Counter] Create $option {*}$args
  3. }
  4.  
  5. proc Create {option args} {
  6. puts "Create $option $args"
  7. Execute $option {*}$args
  8.  
  9. }
  10.  
  11. proc Execute {delay args} {
  12. puts "Execute $delay $args"
  13. after $delay [info coroutine]
  14. yield
  15. {*}$args
  16. Execute $delay {*}$args
  17. }