Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't wish to be a wet blanket on what, to me, seems like a neat idea (but I will anyway).

Using the PID for the name of a pipe could give a race condition: rare, but possible. Senario:
1. Process A wants to send a signal to Process B, so opens the pipe.(CreateFile).
2. Process B ends.
3. Process C starts with the same PID as Process B. PIDs can get reused at once on Windows.
4. Process A sends the signal, but to C instead of B.

A "linger" mechanism is required, or maybe some other identifier to be passed down the pipe? At least the process can detect if the pipe already exists before creating it, but the possibility of a race still exists in the period between Process A getting the PID and actually sending the signal.

There are also issues to be thought through with threads, particularly considering the implementation of fork. Using a TID rather than a PID may resolve them, and make the race condition less likely, but still not impossible. Update: What would be really good is an implementation of waitid() with siginfo_t fully supported.

In reply to Re: Implementing signals for Win32 Perl using named pipes by cdarke
in thread Implementing signals for Win32 Perl using named pipes by Corion

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 surveying the Monastery: (2)
As of 2024-04-25 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found