diff --git a/sched/pthread_exit.c b/sched/pthread_exit.c index 087076ac3d..59dea63e76 100644 --- a/sched/pthread_exit.c +++ b/sched/pthread_exit.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,17 @@ void pthread_exit(FAR void *exit_value) dbg("exit_value=%p\n", exit_value); + /* Block any signal actions that would awaken us while were + * are performing the JOIN handshake. + */ + +#ifndef CONFIG_DISABLE_SIGNALS + { + sigset_t set = ALL_SIGNAL_SET; + (void)sigprocmask(SIG_SETMASK, &set, NULL); + } +#endif + /* Complete pending join operations */ status = pthread_completejoin(getpid(), exit_value);