fix(soft-irq): fix SIGINT exit error
This commit is contained in:
parent
c57d46a171
commit
7e74a8fd45
1 changed files with 7 additions and 3 deletions
10
main.c
10
main.c
|
@ -2,7 +2,7 @@
|
||||||
* @Author: 1ridic
|
* @Author: 1ridic
|
||||||
* @Date: 2022-09-18 14:13:59
|
* @Date: 2022-09-18 14:13:59
|
||||||
* @Last Modified by: 1ridic
|
* @Last Modified by: 1ridic
|
||||||
* @Last Modified time: 2022-09-18 14:53:04
|
* @Last Modified time: 2022-09-18 20:43:07
|
||||||
*/
|
*/
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -12,11 +12,15 @@
|
||||||
|
|
||||||
char volatile isWaiting = 0;
|
char volatile isWaiting = 0;
|
||||||
void intHandler(int dummy) {
|
void intHandler(int dummy) {
|
||||||
if (isWaiting) {
|
#ifdef DEBUG
|
||||||
|
fprintf(stdout,"\ndebug: enter soft-irq. isWaiting=%d\n",isWaiting);
|
||||||
|
#endif
|
||||||
|
if (isWaiting==1) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
fprintf(stderr,"\nSIGINT exit.\n");
|
fprintf(stderr,"\nSIGINT exit.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
Loading…
Reference in a new issue