Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051748]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2018-06-19 09:46 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (113 votes). Check out past polls.