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

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


The following commit(s) were added to refs/heads/master by this push:
     new 068e187  testing: getprime: Fix to wait for all the threads to finish
068e187 is described below

commit 068e1877b8a7ea8dc8c73df7dd3f2692fcb8bb8d
Author: Masayuki Ishikawa <[email protected]>
AuthorDate: Tue Jun 8 10:35:54 2021 +0900

    testing: getprime: Fix to wait for all the threads to finish
    
    Summary:
    - I noticed that sometimes getprime causes ASSERT in tls_getset.c
    - This commit fixes this issue.
    
    Impact:
    - None
    
    Testing:
    - Tested with spresense:wifi_smp
    
    Signed-off-by: Masayuki Ishikawa <[email protected]>
---
 testing/getprime/getprime_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/testing/getprime/getprime_main.c b/testing/getprime/getprime_main.c
index 5b219bc..b47a7d3 100644
--- a/testing/getprime/getprime_main.c
+++ b/testing/getprime/getprime_main.c
@@ -147,9 +147,12 @@ static void get_prime_in_parallel(int n)
       ASSERT(status == OK);
     }
 
-  /* Wait for finishing the last thread */
+  /* Wait for all the threads to finish */
 
-  pthread_join(thread[n - 1], &result);
+  for (i = 0; i < n; i++)
+    {
+      pthread_join(thread[i], &result);
+    }
 
   printf("Done\n");
 }

Reply via email to