• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

restarting an interrupted thread

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic