S
Salman Zari Ghanvi
I started two threads (thread1 and thread2) from main thread ... and after a
while thread1 stops.
Can I restart thread1 from thread2?
Actual problem:
I have started two threads from main thread. One is a real working thread
(thread1) and the other is a watchdog thread that watches thread1.isAlive
property.
If thread1 dies (because of throwing some exception), I want watchdog to
attempt a restart of thread1 for a few times before logging failure.
So .. can watchdog restart thread1? (remember they are siblings).
In thread1, is there a better way of handling exceptions (e.g. should it
suspend itself in case exceptions .. and let watchdog resume it.)? I read a
little about ManualResetEvent - Is it a better candidate for this stop/retry
situation.
Any other ideas to achieve the same?
Thanks.
SalmanZG
while thread1 stops.
Can I restart thread1 from thread2?
Actual problem:
I have started two threads from main thread. One is a real working thread
(thread1) and the other is a watchdog thread that watches thread1.isAlive
property.
If thread1 dies (because of throwing some exception), I want watchdog to
attempt a restart of thread1 for a few times before logging failure.
So .. can watchdog restart thread1? (remember they are siblings).
In thread1, is there a better way of handling exceptions (e.g. should it
suspend itself in case exceptions .. and let watchdog resume it.)? I read a
little about ManualResetEvent - Is it a better candidate for this stop/retry
situation.
Any other ideas to achieve the same?
Thanks.
SalmanZG