[plt-scheme] parent and child thread's lifetime

From: YC (yinso.chen at gmail.com)
Date: Thu Apr 16 01:44:58 EDT 2009

On Wed, Apr 15, 2009 at 5:55 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:

>
> > I have a thread that creates another thread and then pretty much
> immediately
> > exits.  The child thread seem to hang without completing all of its
> tasks.
> > I verified that the child thread is dead.
> >
> > Is there a potential issue between their respective lifetimes?
>
> No, it must be something else. The death of the older thread doesn't
> automatically kill the newer thread.
>

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.

I finally solved the problem via introducing an intermediate long running
thread to create the child threads.

So originally it was:

server -> short-living threads for tcp comm -> each creates an asynchronous
worker thread

Then I change it to:

server -> shot-living thread for tcp comm -> pass message to a separate long
living thread -> the long living thread creates asynchronous worker thread

As far as I can tell, it has something to do with the threads creation
order, but I still cannot make out the problem...

Any thoughts on what it might be?

Thanks,
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090415/b521bef2/attachment.html>

Posted on the users mailing list.