• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads can be restarted?

 
Harathi Rao
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to restart a thread which is about to expire?

Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threads can be started (by calling start()) just once. You can have a thread that runs multiple tasks, though, by having its body be a loop which runs assigned tasks -- something like



The getNextTask() method could simply block (using wait()) until there was work available to do. This is how "thread pools" work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!