By the way, guys, below please find my code. I was trying to use
wait() inside synchronization. I have the same logic working perfectly
fine in the scenario when the main thread cancels an AsyncTask and
waits for it to finish. Whether there will be deadlock or not, depends
on the implementation mistakes I think.

synchronized(mContext)
{
  if (mContactsMessages.isEmpty())
  {
    mConsumerThreadWaitingForMessages = true;
    while(mConsumerThreadWaitingForMessages)
    {
      try
      {
        this.wait();
      }
      catch (InterruptedException e)
      {
        // Do nothing!
      }
    }
  }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to