Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: The implementation of SIGHUP in Win32 Perl

by moritz (Cardinal)
on Aug 31, 2013 at 09:08 UTC ( [id://1051697]=note: print w/replies, xml ) Need Help??


in reply to The implementation of SIGHUP in Win32 Perl

What happens if the main thread terminates while the signal handler thread is still sleeping? And what happens if there's another SIGHUP while the signal handler thread is still sleeping?

  • Comment on Re: The implementation of SIGHUP in Win32 Perl

Replies are listed 'Best First'.
Re^2: The implementation of SIGHUP in Win32 Perl
by klaten (Novice) on Aug 31, 2013 at 19:34 UTC

    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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found