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

Running threads in Sequence

 
Deep Gagan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a question, suppose we have 100 threads e.g T1, T2, T3 . . . T100. I want threads to run in sequence. First T1 completes then T2, then T3….at last T100. Is there any way to implement this ?
Or
You can say each thread prints its Name .
So my output should be
T1 T2 T3 T4.........T100

Thanks
Gagan.
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well there is a way but I don't think that will be too much useful

have you heard of the join method on threads?

can you write code using join method?

 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So basically you want all those thread to run in a single thread. Instead of calling the start method call the run method.
But can you tell us why you created those threads in the first place if you didn't want multi-threaded behaviour.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic