raise.c
来自「德州仪器(TI) 的超低功耗16 位RISC 混合信号处理器的MSP430 平台」· C语言 代码 · 共 47 行
C
47 行
/*******************
*
* Copyright 1998-2003 IAR Systems. All rights reserved.
*
* $Revision: 1.6 $
*
* This is the default implementation of the "raise" function of the
* standard library. It can be replaced with a system-specific
* implementation.
*
* The "raise" function should call the signal handler for the raised
* signal, or terminate and possibly report an error.
*
********************/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
_STD_BEGIN
int (raise)(int sig)
{ /* raise a signal */
_Sigfun *const s = signal(sig, SIG_IGN);
if (s == SIG_ERR)
return (-1); /* bad signal */
else if (s == SIG_IGN)
;
else if (s != SIG_DFL)
{ /* revert and call handler */
signal(sig, SIG_DFL);
(*s)(sig);
}
else
{ /* default handling */
exit(EXIT_FAILURE);
}
return 0;
}
_STD_END
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.12:0576 */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?