THREADS AND LOCKS
Wait Sets and Notification
17.14
Some other thread invokes the
notify
method for that object and thread
T
happens to be the one arbitrarily chosen as the one to notify.
Some other thread invokes the
notifyAll
method for that object.
If the call by thread
T
to the wait method specified a timeout interval, the
specified amount of real time has elapsed.
The thread
T
is then removed from the wait set and re enabled for thread schedul
ing. It then locks the object again (which may involve competing in the usual
manner with other threads); once it has gained control of the lock, it performs
N
1 additional
lock
actions and then returns from the invocation of the
wait
method. Thus, on return from the
wait
method, the state of the object's lock is
exactly as it was when the
wait
method was invoked.
The
notify
method should be called for an object only when the current
thread has already locked the object's lock. If the wait set for the object is not
empty, then some arbitrarily chosen thread is removed from the wait set and re
enabled for thread scheduling. (Of course, that thread will not be able to proceed
until the current thread relinquishes the object's lock.)
The
notifyAll
method should be called for an object only when the current
thread has already locked the object's lock. Every thread in the wait set for the
object is removed from the wait set and re enabled for thread scheduling. (Of
course, those threads will not be able to proceed until the current thread relin
quishes the object's lock.)
These pearls of thought in Persian gulfs were bred,
Each softly lucent as a rounded moon;
The diver Omar plucked them from their bed,
Fitzgerald strung them on an English thread.
James Russell Lowell,
in a copy of Omar Khayyam
417
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved