• Post Reply Bookmark Topic Watch Topic
  • New Topic

Weird behavior  RSS feed

 
puff li
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am writing multithreading Java program. I have one thread waiting for another thread to reach some point in an infinite loop. However, after some iterations, it will never reach that same point again. It seems it stucks, but its state is still runnable. Can some one explain why it is like this? Is it possible the JVM will never execute a thread which is busy waiting or the OS will stop it? I debugged the program for a day but still can't figure out what is wrong... Please help.

Thanks in advance.
 
Paul Clapham
Sheriff
Posts: 22378
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There were four instances of "it" in that question and I couldn't understand what they all referred to. However let me just say that if you have a thread waiting for an event that will never happen, then yes, that thread will indeed wait forever. Unless the thread is written so that it times out after a certain length of time, of course. However if you've programmed it so that it will wait indefinitely, then yes, it may wait indefinitely.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!