q**q 发帖数: 266 | 1 如题。比如一个thread用sleep进入timed_waiting或用wait,join进入waiting state之
前,它是不是要释放它所拥有的所有lock?
谢谢。 |
r*****l 发帖数: 2859 | 2 Method wait() is associated with one object. Calling this method will cause
the thread to surrender the lock of that object.
【在 q**q 的大作中提到】 : 如题。比如一个thread用sleep进入timed_waiting或用wait,join进入waiting state之 : 前,它是不是要释放它所拥有的所有lock? : 谢谢。
|
q**q 发帖数: 266 | 3 Thanks. What about sleep? Suppose the sleep method is invoked inside a
synchronized statement
cause
【在 r*****l 的大作中提到】 : Method wait() is associated with one object. Calling this method will cause : the thread to surrender the lock of that object.
|
r*****l 发帖数: 2859 | 4 http://docs.oracle.com/javase/6/docs/api/
One comment on that page for sleep():
"The thread does not lose ownership of any monitors."
【在 q**q 的大作中提到】 : Thanks. What about sleep? Suppose the sleep method is invoked inside a : synchronized statement : : cause
|
q**q 发帖数: 266 | 5 Thank you very much! I didn't notice this.
【在 r*****l 的大作中提到】 : http://docs.oracle.com/javase/6/docs/api/ : One comment on that page for sleep(): : "The thread does not lose ownership of any monitors."
|