Can some subclass from Thread call Condition's function signal() if any other Thread isn't call await()?

Milorad Maric :

Example, two threads (Informer and Watcher) use same List. Informer add data in List and Watcher can't read collection if collection is empty or if Informer access the List. What will happen if Informer call function Condition.signal() but Watcher is not created or not started (Watcher not call Condition.await() ) ?

xingbin :

Yes, it's possible to call signal even there is no waiting thread. The waiting thread will miss this signal, and it will get blocked when it does call await().

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=159272&siteId=1