multithreading - Notification in Java thread synchronization -


when there multiple threads in waiting state; , if call notify() rather calling notifyall() 1 going notified among several threads in waiting state?

that's undefined behavior. picked up. javadoc:

if threads waiting on object, 1 of them chosen awakened. the choice arbitrary , occurs @ discretion of implementation.

and yes, can lead thread starvation.


Comments