search

Home  >  Q&A  >  body text

JAVA中间Object.wait()或者Condition.await()这样的条件状态满足条件之后重新获取锁的顺序问题?

rt,谁能给解释下?或者给点路子怎么找相关资料?

伊谢尔伦伊谢尔伦2802 days ago910

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-18 10:51:55

    If multiple threads wait, it should be based on the thread priority. Those with the same priority are random. I can’t remember clearly, so I’ll check the internet again and change my answer.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:51:55

    Object.wait()
    Needs notify() or notifyAll() to wake up the thread. The former randomly wakes up a thread and then acquires the lock. There is no competition for the lock. The latter compete randomly by priority.
    Condition to be added.

    reply
    0
  • Cancelreply