java - Does a thread notity another joined thread when it finishes execution? -
i'm developing android app.
i have 2 threads. first 1 has wait second one.
i have code on first thread run method:
@override public void run() { synchronized (this.secondthread) { this.secondthread.wait(); } [...] } and on second thread:
@override public void run() { synchronized (myclass.mylock) { try { // important here } catch (exception ex) { // manage exception return; } { // something... } } synchronized (this) { this.notify(); } [...] }
as can see, there return inside catch block.
with code, will first thread notified if exception occurs on second thread?
will first thread notified if exception occurs on second thread?
answer no. unless explicitly notify() in catch block before returning, other thread not wake up
Comments
Post a Comment