in reply to Handling badly behaved system calls in threads

You might be creating strawmen ( relatives of zombies), as ikegami pointed out in Re^3: Stopping subprocesses

That is the first time I've seen the strawman behavior, it's like grandchildren that won't die as part of a kill command. Only saving the pid of the command or it's associated shell, and killing it's pid will clean them up.

As you switch from backticks, to a form of IPC that gives the pid, have your slave threads either kill the pid themselves before joining(ending), or have them stuff the pid into a thread shared variable, so the master thread can do the cleanup.

In my experience, I always use Proc::Killfam on the pid obtained in the slave thread, since it will kill the shell and program pid.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: Handling badly behaved system calls in threads

Replies are listed 'Best First'.
Re^2: Handling badly behaved system calls in threads
by kennethk (Abbot) on Aug 27, 2010 at 16:35 UTC
    Thanks for the info. I'll check Proc::Killfam out, though I try to avoid non-core dependencies when I can on this box as it's an Ubuntu server.

    I think BrowserUK identified why I was creating strawmen in Re^3: Handling badly behaved system calls in threads - I'm still working through the code examples he's posted for avoiding invoking the shell. Not relying to feeding backticked system calls through regular expressions appeals to me greatly.