Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
To be really careful, a program which forks should avoid letting the kids inherit such connections.

Ideally, that's exactly what I'd do. Unfortunately, I'm not aware that any such method really exists. If there is such a way, I'd love to learn about it. For anything that is some sort of file handle or socket (including all my examples above), the only way (that I know of) that you can "avoid letting the kids inherit" it is to close it before forking. Of course, that fails to meet the broader goal of isolating it from unintended side-effect. (Closing it is a pretty big side-effect.)

By the way, if this sounds argumentative, it's not intended. I'm aiming for "inquisitive". (It can be very hard to accurately convey tone in a text-only medium.) I'd really like to learn more about what facilities there are for making this kind of mess easier (if any exist). I can't tell if what you're saying is "Too bad this sort of necessary when dealing with sockets and handles and forks" or if what you're saying is "Geez, I can't believe you don't know about MagicallyAwesomeFork that allows you to selectively not copy portions of your process in the fork." Although I'm confused as to how that could possibly be accomplished, I'd definitely like to learn.

------------ :Wq Not an editor command: Wq

In reply to Re^4: Fork-safe DBI handles via ChildHandles and InactiveDestroy by etcshadow
in thread Fork-safe DBI handles via ChildHandles and InactiveDestroy by etcshadow

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found