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

Inter thread communication not working  RSS feed

 
charak roy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The driver program is the following.The used classes are shown below that
The problem is that the message printer thread never comes out of the wait.

 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use code tags when posting code.

The problem in your code is that the timer thread never gives up the lock on 'time'. Ideally it should itself go to wait after calling notifyAll and same should be done by the message printer thread.
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MsgPrinterThread runs an infinite loop, that' why.
 
charak roy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks @Satya,it works with these changes
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!