Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sleeping threads  RSS feed

Dale Harvey
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Im developing a very simple betting game where you bet on which car will win a race, the cars are implemented as seperate threads,

I need the threads to wait for a notification before they start racing, so I have them checking a boolean, waiting if its false

However when the class that invoked the threads calls notifyAll() , the threads dont wake up

the code is here

( line 200 is the wait, notifyAll is 123 )

this is the code actually working exactly how i would like it, however checking the boolean in a while(true) loop isnt exactly effiecient, and doesnt really demonstrate concurrency
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!