examples: Ignore the default action if app call sigwait
Because the configured signo may have the default action(e.g. SIGPIPE), and then will generate the bad side effect before the caller wakeup. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
b506600c5b
commit
12a5a5cce9
@ -230,6 +230,10 @@ static int button_daemon(int argc, char *argv[])
|
||||
errcode);
|
||||
goto errout_with_fd;
|
||||
}
|
||||
|
||||
/* Ignore the default signal action */
|
||||
|
||||
signal(CONFIG_EXAMPLES_BUTTONS_SIGNO, SIG_IGN);
|
||||
#endif
|
||||
|
||||
/* Now loop forever, waiting BUTTONs events */
|
||||
|
@ -177,6 +177,10 @@ static int chrono_daemon(int argc, char *argv[])
|
||||
goto errout_with_fd;
|
||||
}
|
||||
|
||||
/* Ignore the default signal action */
|
||||
|
||||
signal(BUTTON_SIGNO, SIG_IGN);
|
||||
|
||||
/* Now loop forever, waiting BUTTONs events */
|
||||
|
||||
for (; ; )
|
||||
|
@ -190,6 +190,10 @@ int main(int argc, FAR char *argv[])
|
||||
goto errout_with_fd;
|
||||
}
|
||||
|
||||
/* Ignore the default signal action */
|
||||
|
||||
signal(CONFIG_EXAMPLES_DJOYSTICK_SIGNO, SIG_IGN);
|
||||
|
||||
/* Then loop, receiving signals indicating joystick events. */
|
||||
|
||||
for (;;)
|
||||
|
@ -181,6 +181,10 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
printf("Maximum delay is %llu\n", maxus);
|
||||
|
||||
/* Ignore the default signal action */
|
||||
|
||||
signal(CONFIG_EXAMPLES_ONESHOT_SIGNO, SIG_IGN);
|
||||
|
||||
/* Loop waiting until the full delay expires */
|
||||
|
||||
while (usecs > 0)
|
||||
|
@ -112,6 +112,10 @@ int main(int argc, FAR char *argv[])
|
||||
goto errout_with_fd;
|
||||
}
|
||||
|
||||
/* Ignore the default signal action */
|
||||
|
||||
signal(CONFIG_EXAMPLES_ZEROCROSS_SIGNO, SIG_IGN);
|
||||
|
||||
/* Then loop, receiving signals indicating zero cross events. */
|
||||
|
||||
for (; ; )
|
||||
|
Loading…
Reference in New Issue
Block a user