fix(soft-irq): fix SIGINT exit error

This commit is contained in:
iridiumR 2022-09-18 20:43:39 +08:00
parent c57d46a171
commit 7e74a8fd45
No known key found for this signature in database
GPG key ID: 5574BE4450D55618

10
main.c
View file

@ -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[]) {