Home Discussion Discuss: Inter-Thread Communication

  • In above first example an error is thereRahul singh sanger February 14, 2013 at 11:58 AM

    synchronized void put(int num) { value=false; // wrong value=true; // right } Here value should change in true not in false.. This is not my doubt is a correction i don't have any other space that why i put it in this section..

  • Programtorres November 30, 2011 at 4:21 PM

    our sir told the same program in the class.... cheater

  • urgentinspector J March 29, 2012 at 1:11 AM

    listen in the shared class the method get() have a loop that repeating if "value" is false and leave loop if true encounters , but at the same time in starting we set "value" is false.Then how the hell "value" suppose to change,it shud not be changed and should not be leaving loop. Utter confusion here plz help plz... Thanks in adv. plz take interest..

  • Incorrect use of wait(0 methodSeshadri Rangaswami December 17, 2012 at 3:54 AM

    The above program shows wait() method invoked with an "if" statement first and with no condiion next. wait method should always be invoked in a while loop. Otherwise the thread will encounter "liveness" problem.

  • Doesn't workScriptKiddi November 29, 2012 at 8:48 PM

    First example doesnt really work - you have to change "value==false" into "value==true" in the put-function (line 35). Thanks for the fish. :)

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
Related Articles