次の状況があるとします。
synchronized void someMethod() {
...
try {
wait();
}catch(InterruptedException e) {
System.out.println("InterruptedException caught");
}
...
}
と
synchronized void someOtherMethod() {
...
notify();
}
そして、Thread最初にアクセスsomeMethodし、入っwaitてからsomeOtherMethod通知し、状態に戻りますRunnable。notify()メソッド内の呼び出しの位置は重要ですか? notify()メソッド内の別の位置に呼び出しを配置しても、動作に変化はありませんでした。
Threadへの呼び出しが行われるとすぐに通知されるべきではありませんnotify()か?