mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
sighand: need block WAKEUP_SIGNAL in current tcb
If the main thread receives the signal, the waiter_main will not be awakened. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
4e8a0ae4c4
commit
21f4156048
1 changed files with 13 additions and 1 deletions
|
|
@ -217,12 +217,13 @@ void sighand_test(void)
|
|||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
struct sigaction act;
|
||||
struct sigaction oact;
|
||||
sigset_t set;
|
||||
#endif
|
||||
struct sched_param param;
|
||||
pthread_attr_t attr;
|
||||
union sigval sigvalue;
|
||||
pid_t waiterpid;
|
||||
sigset_t oset;
|
||||
sigset_t set;
|
||||
int status;
|
||||
|
||||
printf("sighand_test: Initializing semaphore to 0\n");
|
||||
|
|
@ -259,6 +260,16 @@ void sighand_test(void)
|
|||
|
||||
/* Start waiter thread */
|
||||
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, WAKEUP_SIGNAL);
|
||||
status = sigprocmask(SIG_BLOCK, &set, &oset);
|
||||
if (status != OK)
|
||||
{
|
||||
printf("sighand_test: ERROR sigprocmask failed, status=%d\n",
|
||||
status);
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
printf("sighand_test: Starting waiter task\n");
|
||||
status = sched_getparam (0, ¶m);
|
||||
if (status != OK)
|
||||
|
|
@ -332,6 +343,7 @@ void sighand_test(void)
|
|||
#endif
|
||||
|
||||
printf("sighand_test: done\n");
|
||||
sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
FFLUSH();
|
||||
sem_destroy(&sem2);
|
||||
sem_destroy(&sem1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue