Apparently, the behavior of signal + raise is specified as such. From Wikipedia's article on sigaction
:
... replacement of the unreliable and deprecated
signal()
function. Signal handlers installed by thesignal()
interface will be uninstalled immediately prior to execution of the handler. Permanent handlers must therefore be reinstalled by a call tosignal()
during the handler's execution, causing ...
So it seems this is expected behavior. (Of course, the MSDN docs seem to completely fail to mention this.)
Question here on SO: What is the difference between sigaction and signal?