Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: child and parent process communication

by jbert (Priest)
on Sep 03, 2008 at 11:59 UTC ( #708730=note: print w/replies, xml ) Need Help??

in reply to child and parent process communication

Your SIGUSR1 idea is OK, but doesn't scale nicely and you'll get a thundering herd of processes all waking up and checking the shared mem area. It'll be N^2 with your number of connections (since you have N procs and presumably O(N) signals).

IMHO, you should open a pipe before the fork and have the child write the userid back to the parent (and then close off the pipes). With a single one-way message, you'll avoid any difficult deadlock situations.

The parent just needs to add it's end of the pipe to your existing select/poll loop and do a read+close (or you'll leak fds) when it gets the info it needs.

  • Comment on Re: child and parent process communication

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://708730]
[Eily]: I actually used the eskimo greeting :P, I just wrote the "canonical" form of the oneliner here
[Discipulus]: next time you can add `SARGV-1` and if still not impressed pass a 'rm -f..' as last arg
[Eily]: :)
[Eily]: or I might be tempted to send him an Acme::EyeDropsed file next time
[Eily]: Acme::Bleach is tempting, but it will look like I'm just using the one module that does precisely exactly what he wants

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2017-04-26 15:14 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (483 votes). Check out past polls.