in reply to Re^3: Win32 signals between parent/child
in thread Win32 signals between parent/child

Win32 only. The two options I know of are socketpair and a file-based semaphore implementation. I'm hoping for something that is simpler than the former, but not quite so brute-force-ish as the latter.
  • Comment on Re^4: Win32 signals between parent/child

Replies are listed 'Best First'.
Re^5: Win32 signals between parent/child
by BrowserUk (Patriarch) on Aug 31, 2007 at 18:24 UTC

    Well, since fork is essentially just a disguised threads->create, the simplist mechanism is to use a shared variable. This is simplistic, but it demonstrates the principle.

    #! perl -slw use strict; use threads; use threads::shared; my $signal :shared = 0; my $parent = $$; print "$$:\tI am the parent.\n"; unless( my $pid = fork){ print "$$:\tI am the child.\n"; lock $signal; $signal = 1; exit; } print "$$:\tWaiting for the child to signal.\n"; sleep 1 until $signal; print "The child signalled."; __END__ c:\test>junk2 1124: I am the parent. 1124: Waiting for the child to signal. -1912: I am the child. The child signalled.

    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.