You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/04/09 05:45:44 UTC

(nuttx-apps) branch master updated: Revert "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.

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 78a8dd27c Revert "testing/ostest/cancel: joining a detached/canceled thread should return EINVAL, not ESRCH"
78a8dd27c is described below

commit 78a8dd27c944db2a8d299dfa0ad199b1b8821c97
Author: chao an <an...@lixiang.com>
AuthorDate: Tue Apr 9 12:24:26 2024 +0800

    Revert "testing/ostest/cancel: joining a detached/canceled thread should return EINVAL, not ESRCH"
    
    This reverts commit 69e497f68127cad345fd13786c5342822c58173f.
    
    In order to ensure the detached thread obtain the correct return
    value from pthread_join()/pthread_cancel(), the detached thread
    will create joininfo to save the detached status after thread
    destroyed.  If there are too many of detached threads in the
    process group, the joininfo will consume too much memory.
    This is not friendly to embedded MCU devices.
    This commit keep the semantics as #11898 was introduced,
    will no longer save joininfo for detached threads to avoid wasting memory.
    
    Refer PR:
    https://github.com/apache/nuttx/pull/12106
    
    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 3c2285933..c0c41b076 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 != EINVAL)
+  else if (status != ESRCH)
     {
       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=EINVAL\n");
+      printf("cancel_test: PASS pthread_join failed with status=ESRCH\n");
     }
 
   /* Test 4: Non-cancelable threads *****************************************/