Guest User

Untitled

a guest
Jun 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 0.26 KB | None | 0 0
  1. package require Thread
  2.  
  3. proc tfunc {i} {
  4.  
  5.     if {$i == 0} {
  6.         return
  7.     }
  8.  
  9.     puts "[thread::id] $i"
  10.  
  11.     # this won't work
  12.     set t [thread::create -joinable]
  13.     thread::send -async $t [list tfunc [incr i -1]]
  14.     thread::join $t
  15.  
  16. }
  17.  
  18. tfunc 10
Add Comment
Please, Sign In to add comment