I wasn't aware that Windows has a process (message) queue. So far, I was under the impression that for a message queue you always needed a window handle.

Um. I get a little fuzzy with my terminology. Threads can(*) have message queues, not processes. Of course, in a single threaded process, the two are (roughly) equivalent.

(*)From PostThreadMessage(): "The system creates a thread's message queue when the thread makes its first call to one of the User or GDI functions.".

In Perl, this (probably) occurs when Win32_create_message_window() is called:

## win32.c HWND win32_create_message_window() { /* "message-only" windows have been implemented in Windows 2000 an +d later. * On earlier versions we'll continue to post messages to a specif +ic * thread and use hwnd==NULL. This is brittle when either an embe +dding * application or an XS module is also posting messages to hwnd=NU +LL * because once removed from the queue they cannot be delivered to + the * "right" place with DispatchMessage() anymore, as there is no Wi +ndowProc * if there is no window handle. */ if (!IsWin2000()) return NULL; return CreateWindow("Static", "", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, +0, NULL); }

See also win32_kill() in the same file.

If you use the fork emulation, to start a non-perl, child process, then a thread is spawned to act as a 'placeholder' for the actual process. This then waits for the alien process to terminate and so can (could?) post (raise) a SIGCHLD to the main or spawning thread. The problem is that signals sent to the child pseudo-process' pseudo-pid do not necessarially reflect the state of, or affect, the real alien process. And that's where the emulation falls down.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^3: Implementing signals for Win32 Perl using named pipes by BrowserUk
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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.