Sean Walker<br />PMP, SCEA, SCWCD, SCJP
But what then? As I have read, all of the waiting threads become 'runnable' which mean that they may be active within the synchronized block at the same time.
Sean Walker<br />PMP, SCEA, SCWCD, SCJP
Please distinguish between the two calls, especially in the situation I have described above - unless, of course, the situation I described assumes something that is not correct.
Originally posted by Sean Walker:
But what then? As I have read, all of the waiting threads become 'runnable' which mean that they may be active within the synchronized block at the same time.
Originally posted by Sean Walker:
But what then? As I have read, all of the waiting threads become 'runnable' which mean that they may be active within the synchronized block at the same time.
Originally posted by Jan Groth:
If an object OneObject has to have aquired a lock on an OtherObject it wants to wait() for, and if - obviously - only one object can hold this lock at any given point of time, doesn't this mean that at any given point only one thread can have called the OtherObject.wait()?
The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution.
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|