Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Waking up a sleeping thread?

 
huny chopra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we wake up a sleeping thread before its sleeping time elapses?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

The Thread sleep() doc gives a good hint ... it can throw an interrupted exception if another thread interrupts it. That's what you need. Let's say MyRunnable sleeps at some point and we want to wake it up:

See if you can make something like that run. Let us know how it goes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic