On Mar 22, 2006, at 8:36 AM, Russ Jones wrote:
One way (of many, I am sure) is to have the calculation thread
periodically (fairly frequently) set a boolean in the parent thread to
say "I'm still alive", and eventually set another boolean in the
parent thread to indicate successful completion.
The parent thread, which is waiting for the completion of the
calculation thread one way or the other, would use a timer to
periodically check the flags.
If the successful completion flag is set, then you are ok.
The same timer would next check then clear the "I'm Alive" flag. If
the timer notices too often that neither flag is set, then it can
assume the offspring calculation died.
As has been noted earlier in this thread, there are many different
solutions to this general problem, and some are better than others
depending on what you are trying to accomplish, and which of the
available tools you are comfortable with.
(I also think that upgrading from 5.5 is a good idea.)
The only downside to the thread tickling a "I'm alive" flag all the
time is that IF the thread sets it and then dies or gets killed the
flag still says it's alive.
A flag that timed out after a certain period and became false
automatically would be handy.
A timer that flipped the flag to false IF the timer itself did not get
reset periodically would work for this sort of timed out flag.
Have a "I'm alive" flag, and a timer.
The thread initially sets the flag to true and starts the timer and
continuously resets the timer so that the timers action never fires
unless the thread is ended and does not reset the timer. The action of
the timer sets the flag to false.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>