Java: How can a thread wait on multiple objects?

后端 未结 8 2152
有刺的猬
有刺的猬 2020-12-30 23:46

A thread can use Object.wait() to block until another thread calls notify() or notifyAll() on that object.

But what if a threa

8条回答
  •  萌比男神i
    2020-12-31 00:27

    Lock in both cases over the same object. Call in case a) or in case b) notify() on the same object.

提交回复
热议问题