Unix to Windows Porting Dictionary for HPC

RSS

Links

Function List

sigaction


Unix

header file: signal.h

int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);

Windows

There is no direct counterpart for this function in Windows; for substitute code, see below.

Purpose

The sigaction function associates a signal handler with the specified signal and sets the signal mask for the handler.

Discussion

The sigaction call is a more comprehensive call than the signal or sigset call, but, depending on usage may be able to be replaced by the signal call. In addition to associating an action (default, ignore, user routine) with any signal, the sigaction call can also be used to set up the signal mask that will be in force while the handler itself is executing. If this is not done, the handler will inherit the mask for the process. If the original code does not make use of this capability, you can substitute the signal() call for the sigaction call.

Normally, the first action taken by the system before executing the handler is to set the signal back to the default system supplied handler. If the user wants to be able to handle future signals they must call signal() again at the end of the handler code to set up the association again.

Example of Use in Windows

For a complete example, download the example code.

blog comments powered by Disqus
Valid HTML 4.01 Transitional Valid CSS!