• Post Reply Bookmark Topic Watch Topic
  • New Topic

restarting an interrupted thread  RSS feed

 
Bill Sherlock
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've got a program in which I need to interrupt a number of threads, reset a variable in the class in which the threads are running, and then restart all of the threads at the point which they were interrupted. I've worked around it using one of Doug Lea's util.concurrent classes but I've been searching high and low for some way to restart a thread NOT using precompiled code. Thanks for your help,
Bill
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any such mechanism is necessarily invasive if it is to be done safely. The javadoc for the deprecated Thread.suspend() and Thread.resume() methods provide a link to a document explaining why. Unless I misunderstand you, what you envision would suffer from the same problems. That's why you have to do some coding yourself using flags and wait() (or rely on a library).
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!