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

Threads and join

 
Roel De Nijs
Sheriff
Posts: 10593
143
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question about joining of threads: i have 3 threads (t1, t2 and t3). t1 can't start unless t3 has finished his job. and t2 can't start unless t1 has ended.

how do you do this in code? where do you place the instance.join() methods?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You put that code in some class that controls the action of those three threads. Like this:I suppose this must be a simplified example of your real problem, though, because it doesn't need threads at all. Just call the three bits of code designated as "..." one after the other.
[ October 23, 2005: Message edited by: Paul Clapham ]
 
Roel De Nijs
Sheriff
Posts: 10593
143
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no it's not a simplified version of a real world problem. i do know what the purpose of the join method is, but i don't know what it means if you call t1.join()

if you call t1.join() from the run-method of t2 will then t2 wait until t1 has finished ?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic