Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Using Win32::GUI on Strawberry perl 5.16.2. According to the FAQ (http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi?doc=userguide-faq) the way to have a long-running "background" process not block the GUI is to do a fork(), and have the child do the work.

I've tested this and it works, but I'm unclear about how to pass a message from the parent to the child in this situation. If I was on UNIX, I'd just do something like

kill USR1 $childpid

but this is Windows, not UNIX, and apparently the return value of fork() is a "pseudo-thread ID" which perlfork says can by used by kill() EXCEPT THAT "the signal will not be delivered while the pseudo-process is blocked by a system call". Well, it just so happens that the child's innermost loop is a select() statement, so from a practical standpoint the child has just shy of a snowball's chance of ever receiving the signal sent by kill (I tested it). So my problem remains: given that fork() returns a "pseudo-thread ID" instead of a real PID or TID, how do I send a message from the parent to the child?


In reply to How to communicate w/ forked child under Strawberry by shadrack

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 studying the Monastery: (7)
As of 2024-03-28 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found