Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: The implementation of SIGHUP in Win32 Perl

by klaten (Novice)
on Aug 31, 2013 at 19:34 UTC ( #1051748=note: print w/ replies, xml ) Need Help??


in reply to Re: The implementation of SIGHUP in Win32 Perl
in thread The implementation of SIGHUP in Win32 Perl

Regarding what happens if the main thread terminated, I assume that the termination is due to the Perl program stopping. Then, the C function, exit(), in the runtime library (called by Perl when stopping) would use the Win32 ExitProcess() system call and would take down all the process threads including the signal handler thread.

Regarding what happens if there's another SIGHUP, the SIGHUP is actually coming from the control handler code which is triggered by a Win32 CTRL_CLOSE_EVENT. Keep in mind that under later versions of Windows, a single CTRL_CLOSE_EVENT means a process is doomed! Soon, or very soon, it's going down! So even if a second SIGHUP came in and caused a segfault in Perl the only thing that would be lost is a cleanup opportunity that we aren't even taking advantage of right now.

Now, about that second or subsequent SIGHUP. Let's say it does get triggered and the sig_terminate(aTHX_ 1); from win32.c activates the $SIG{ 'HUP' } in the Perl program. I imagine it would have the same effect as any other repeated signal in Perl, that is the effect would depend on the $SIG handler, maybe it segfaults, maybe its ignored, maybe . . ., but it would be the same as in Linux or elsewhere.


Comment on Re^2: The implementation of SIGHUP in Win32 Perl
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2014-07-13 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (248 votes), past polls