This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 21f415604 sighand: need block WAKEUP_SIGNAL in current tcb
21f415604 is described below

commit 21f41560480dcc147decef2dc72dab440a76087d
Author: hujun5 <[email protected]>
AuthorDate: Thu Mar 13 18:02:44 2025 +0800

    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 <[email protected]>
---
 testing/ostest/sighand.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/testing/ostest/sighand.c b/testing/ostest/sighand.c
index e7f3f5318..c368a37f1 100644
--- a/testing/ostest/sighand.c
+++ b/testing/ostest/sighand.c
@@ -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, &param);
   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);

Reply via email to