[lkml]   [1997]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Killing clones
Richard Henderson writes:
> > But how does this manager know when the parent has died? Does it
> > periodically wake up and check if its ppid == 1? Yuk.
> Yep.

Yeah, well since I didn't like the idea of a process waking up
periodically, I've implemented another scheme. The parent sets up a
pipe, I close the write end in the threads and do a select(2) for
input in the threads. When the parent dies, the select will
return. The child threads can then check if ppid has changed. It just
means I can no longer clone FDs, but that should not be a problem (I
don't expect to do I/O in the threads, just computations).



 \ /
  Last update: 2005-03-22 13:40    [W:0.045 / U:42.856 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site