1 |
Threadsafe Variables
|
2 |
void notify()
|
3 |
void notifyAll()
-
The notify() and notifyall() methods are part of the Object class, and hence available for every object.
-
These methods must be called from a synchronized method.
-
These methods simply notifies a thread that is waiting.
|
4 |
notify() notifies the thread associated with given synchronization object that has been waiting the longest time
|
5 |
notifyall() notifies all threads associated with given object
|
6 |
One can mark a variable as "threadsafe" to notify the compiler that only one thread will be modifying this variable.
|