Guest User

Untitled

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