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:
Xiang Xiao 2020-11-18 12:28:11 +08:00 committed by Abdelatif Guettouche
parent b506600c5b
commit 12a5a5cce9
5 changed files with 20 additions and 0 deletions

View File

@ -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 */

View File

@ -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 (; ; )

View File

@ -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 (;;)

View File

@ -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)

View File

@ -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 (; ; )