Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join() method

 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
In the code snippet below, how can I get t2 join t1? thanks.
 
Vad Fogel
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dennis, if I get your question right, a possible solution with minor modifications can look like this:

Hope this helps.
[ December 24, 2003: Message edited by: Vad Fogel ]
 
venkatesh rajmendram
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The code looks good, but just one thing that poped into my mind...
What if t2 never gets chance to run before t1, meaning there won't be actual join... ? or what if t1 will never get chance to run....and t1 goes ahead and finishes....
I might not sure but how about this code ...

Just that t2 starts t1 and joins itself...
Thanks
Venkatesh
 
Vad Fogel
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a call to the thread's isAlive() method returns false, you can still join a currently executing thread to it. isAlive() returns false if a thread hasn't been started or its run() has completed. In this event, t.join() returns immediately to allow the current thread to continue executing.
[ December 24, 2003: Message edited by: Vad Fogel ]
 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vad, Venkatesh. I love this place!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic