tirwhan,
Be careful when doing what - using sig handlers or hitting CTRL-C? The problem that you seem to be referencing has nothing to do with signal handling and everything to do with unsafe signals.
The basic problem is that prior to 5.8.0, Perl would process a received signal immediately even if it was in the middle of an operation. This could make lead to some undesireable behavior when signals were received (intentionally such as hitting CTRL-C or otherwise). The problem with the alternative (safe signals) is that it may be this long running operation you want to abort midstream. With 5.8.1 and above, you can set an environment variable to get back the old functionality (which some find to be desireable) called unsafe-signals.
Understanding is the key since the word "unsafe" leads to certain connotations that may not be applicable to a given circumstance. It is the reason why the N (nuclear) in NMRI has been almost universally dropped - people freak out when they hear it.
| [reply] |
Hmm, not wanting to get into a semantic squabble here, but unless I'm mistaken (which is always possible) it is the signal handler, not the signal itself which was unsafe. Or more precisely the way perl used to process signals wich allowed for "unsafe" handling.
I was referring to Zaxo's signal handler, which printed out a string. As the linked node mentions, it is possible to cause a core dump when doing stdio in a signal handler during another stdio operation. So I figured a word of warning would be appropriate, since the original poster seemed to want to intercept the SIGINT and carry on regardless. Sorry for not explaining that in more detail earlier.
| [reply] |
tirwhan,
Or more precisely the way perl used to process signals
This is the core of the issue which is a potential problem regardless if you have signal handlers or not. It wasn't obvious that you were referring to something specific about Zaxo's post to be concerned with. In light of that, I would agree that caution is warranted. In other words, adding a signal handler may exacerbate a potential problem.
| [reply] |