Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to stop a thread that is waiting for input?  RSS feed

 
Andrew Lit
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this is a console program
thank you in advance
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your inter-thread communication uses the wait()/notify() mechanism, -- you can do just that, -- notify the waiting thread so that it can resume. If the thread in question contains a while loop as part of its run() method, you can set a boolean to terminate to exit from that loop.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think his real question is "How can you interrupt a call to System.in.read()?" Unfortunately, I don't know the answer: interrupt() doesn't work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!