You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2024/03/13 09:06:41 UTC

(nuttx-apps) branch master updated: testing/ostest/cancel: joining a detached/canceled thread should return EINVAL, not ESRCH

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

masayuki 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 69e497f68 testing/ostest/cancel: joining a detached/canceled thread should return EINVAL, not ESRCH
69e497f68 is described below

commit 69e497f68127cad345fd13786c5342822c58173f
Author: chao an <an...@lixiang.com>
AuthorDate: Tue Mar 12 15:56:28 2024 +0800

    testing/ostest/cancel: joining a detached/canceled thread should return EINVAL, not ESRCH
    
    Reference:
    https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_join.html
      [EINVAL]
        The value specified by thread does not refer to a joinable thread.
    
    https://docs.oracle.com/cd/E19120-01/open.solaris/816-5137/tlib-25/index.html
    
      EINVAL
        The thread corresponding to the given thread ID is a detached thread.
    
    https://linux.die.net/man/3/pthread_join
    
      EINVAL
        thread is not a joinable thread.
    
    Signed-off-by: chao an <an...@lixiang.com>
---
 testing/ostest/cancel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testing/ostest/cancel.c b/testing/ostest/cancel.c
index c0c41b076..3c2285933 100644
--- a/testing/ostest/cancel.c
+++ b/testing/ostest/cancel.c
@@ -607,7 +607,7 @@ void cancel_test(void)
       printf("cancel_test: ERROR pthread_join succeeded\n");
       ASSERT(false);
     }
-  else if (status != ESRCH)
+  else if (status != EINVAL)
     {
       printf("cancel_test:"
              " ERROR pthread_join failed but with wrong status=%d\n",
@@ -616,7 +616,7 @@ void cancel_test(void)
     }
   else
     {
-      printf("cancel_test: PASS pthread_join failed with status=ESRCH\n");
+      printf("cancel_test: PASS pthread_join failed with status=EINVAL\n");
     }
 
   /* Test 4: Non-cancelable threads *****************************************/