<br><div class="gmail_quote">On Wed, Apr 15, 2009 at 5:55 PM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
> I have a thread that creates another thread and then pretty much immediately<br>
> exits. The child thread seem to hang without completing all of its tasks.<br>
> I verified that the child thread is dead.<br>
><br>
> Is there a potential issue between their respective lifetimes?<br>
<br>
</div>No, it must be something else. The death of the older thread doesn't<br>
automatically kill the newer thread.<br>
</blockquote></div><br>I tried to trace the child threads to no
avail - the thread is either not started or hang in the middle. And
they cannot be resumed. <br>
<br>
I finally solved the problem via introducing an intermediate long running thread to create the child threads. <br><br>So originally it was:<br><br>server -> short-living threads for tcp comm -> each creates an asynchronous worker thread<br>
<br>Then I change it to:<br><br>server -> shot-living thread for tcp
comm -> pass message to a separate long living thread -> the long
living thread creates asynchronous worker thread <br><br>As far as I can tell, it has something to do with the threads creation order, but I still cannot make out the problem... <br>
<br>Any thoughts on what it might be?<br><br>Thanks,<br>yc<br><br>