Threading - wait()

后端 未结 2 1066
深忆病人
深忆病人 2021-01-21 06:28

The wait() method on an object can be called only in the synchronized context i.e. the current thread must have a lock on the object to invoke the wait()

2条回答
  •  孤街浪徒
    2021-01-21 06:52

    You only need to be synchronized for the duration of calling the wait() method, not for the duration of the wait time.

提交回复
热议问题