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.git

commit 5060ee80d17f45d56fecf1795048bb9e5c908334
Author: wangchengdong <[email protected]>
AuthorDate: Sun Feb 8 15:57:55 2026 +0800

    libs/pthread: disable pthread_kill when no signals
    
     pthread_kill depends on signasl, so when all signals are disabled
     disable pthread_kill too
    
    Signed-off-by: Chengdong Wang <[email protected]>
---
 libs/libc/pthread/CMakeLists.txt          | 5 ++++-
 libs/libc/pthread/Make.defs               | 6 +++++-
 libs/libc/pthread/pthread_mutex_destroy.c | 2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libs/libc/pthread/CMakeLists.txt b/libs/libc/pthread/CMakeLists.txt
index 4032cdecf56..96ff96e8225 100644
--- a/libs/libc/pthread/CMakeLists.txt
+++ b/libs/libc/pthread/CMakeLists.txt
@@ -76,7 +76,6 @@ if(NOT CONFIG_DISABLE_PTHREAD)
     pthread_create.c
     pthread_equal.c
     pthread_exit.c
-    pthread_kill.c
     pthread_setname_np.c
     pthread_getname_np.c
     pthread_get_stackaddr_np.c
@@ -132,6 +131,10 @@ if(NOT CONFIG_DISABLE_PTHREAD)
     list(APPEND SRCS pthread_spinlock.c)
   endif()
 
+  if(NOT CONFIG_DISABLE_ALL_SIGNALS)
+    list(APPEND SRCS pthread_kill.c)
+  endif()
+
   if(NOT CONFIG_TLS_NCLEANUP EQUAL 0)
     list(APPEND SRCS pthread_cleanup.c)
   endif()
diff --git a/libs/libc/pthread/Make.defs b/libs/libc/pthread/Make.defs
index b043230e23b..14a4200d0c8 100644
--- a/libs/libc/pthread/Make.defs
+++ b/libs/libc/pthread/Make.defs
@@ -47,7 +47,7 @@ CSRCS += pthread_condattr_getpshared.c 
pthread_condattr_setpshared.c
 CSRCS += pthread_condattr_setclock.c pthread_condattr_getclock.c
 CSRCS += pthread_condinit.c pthread_conddestroy.c pthread_condtimedwait.c
 CSRCS += pthread_equal.c pthread_condbroadcast.c pthread_condclockwait.c 
pthread_condsignal.c
-CSRCS += pthread_condwait.c pthread_create.c pthread_exit.c pthread_kill.c
+CSRCS += pthread_condwait.c pthread_create.c pthread_exit.c
 CSRCS += pthread_setname_np.c pthread_getname_np.c
 CSRCS += pthread_get_stackaddr_np.c pthread_get_stacksize_np.c
 CSRCS += pthread_mutexattr_init.c pthread_mutexattr_destroy.c
@@ -69,6 +69,10 @@ CSRCS += pthread_testcancel.c pthread_getcpuclockid.c
 CSRCS += pthread_self.c pthread_gettid_np.c
 CSRCS += pthread_concurrency.c
 
+ifneq ($(CONFIG_DISABLE_ALL_SIGNALS),y)
+CSRCS += pthread_kill.c
+endif
+
 ifeq ($(CONFIG_SMP),y)
 CSRCS += pthread_attr_getaffinity.c pthread_attr_setaffinity.c
 endif
diff --git a/libs/libc/pthread/pthread_mutex_destroy.c 
b/libs/libc/pthread/pthread_mutex_destroy.c
index 8bfb6cf1686..6cbc7c306b6 100644
--- a/libs/libc/pthread/pthread_mutex_destroy.c
+++ b/libs/libc/pthread/pthread_mutex_destroy.c
@@ -90,6 +90,7 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex)
            * nxsched_get_tcb() does.
            */
 
+#ifndef CONFIG_DISABLE_ALL_SIGNALS
           if (pthread_kill(pid, 0) != 0)
             {
               /* The thread associated with the PID no longer exists */
@@ -121,6 +122,7 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex)
                 }
             }
           else
+#endif
             {
               ret = EBUSY;
             }

Reply via email to