how do we ever make it to checkpoint d? right after checkpoint b we tell the other thread waiting on the Object (by calling obj.notify() ) that it's wait() should try to reacquire the lock on the Object so it may continue. *But* since we drag our feet with the sleep(), during that time, shouldn't the other thread's wait() see that it cannot get the lock at this time, and just go back to wait()'ing?
John M. Gabriele
Joined: Feb 18, 2001
whoops! i understand it now. calling notify() on an object upon which other threads are wait()'ing simply switches the waiting thread's "state" from, waiting regardless of whether or not the object has a lock on it to waiting to grab the object's lock as soon as it is available. i hope this post helped others. it helped me. heh.
subject: if wait() can't immediately reacquire the lock, then...?