📄 raise.c
字号:
/* Embedded systems may want the simulated signals if no other form exists, but UNIX versions will want to use the host facilities. Define SIMULATED_SIGNALS when you want to use the simulated versions.*//*FUNCTION<<raise>>---send a signalINDEX raiseINDEX _raise_rANSI_SYNOPSIS #include <signal.h> int raise(int <[sig]>); int _raise_r(void *<[reent]>, int <[sig]>);TRAD_SYNOPSIS #include <signal.h> int raise(<[sig]>) int <[sig]>; int _raise_r(<[reent]>, <[sig]>) char *<[reent]>; int <[sig]>;DESCRIPTIONSend the signal <[sig]> (one of the macros from `<<sys/signal.h>>').This interrupts your program's normal flow of execution, and allows a signalhandler (if you've defined one, using <<signal>>) to take control.The alternate function <<_raise_r>> is a reentrant version. The extraargument <[reent]> is a pointer to a reentrancy structure.RETURNSThe result is <<0>> if <[sig]> was successfully raised, <<1>>otherwise. However, the return value (since it depends on the normalflow of execution) may not be visible, unless the signal handler for<[sig]> terminates with a <<return>> or unless <<SIG_IGN>> is ineffect for this signal.PORTABILITYANSI C requires <<raise>>, but allows the full set of signal numbersto vary from one implementation to another.Required OS subroutines: <<getpid>>, <<kill>>.*/#ifdef SIMULATED_SIGNALSint _dummy_raise;#else#include <reent.h>#include <signal.h>#ifndef _REENT_ONLYint_DEFUN (raise, (sig), int sig){ return _raise_r (_REENT, sig);}#endifint_DEFUN (_raise_r, (reent, sig), struct _reent *reent _AND int sig){ return _kill_r (reent, _getpid_r (reent), sig);}#endif /* ! SIMULATED_SIGNALS */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -