You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/28 13:58:22 UTC

[incubator-nuttx-apps] branch master updated: testing: ostest: Add workaround for SMP in cond.c

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 102d767  testing: ostest: Add workaround for SMP in cond.c
102d767 is described below

commit 102d7670c3f1b576332d77dfbedde7200e8229c2
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Fri Feb 28 17:06:44 2020 +0900

    testing: ostest: Add workaround for SMP in cond.c
    
    Signed-off-by: Masayuki Ishikawa <ma...@gmail.com>
---
 testing/ostest/cond.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/testing/ostest/cond.c b/testing/ostest/cond.c
index 5c01085..5a38066 100644
--- a/testing/ostest/cond.c
+++ b/testing/ostest/cond.c
@@ -181,6 +181,19 @@ static void *thread_signaler(void *parameter)
           signaler_nerrors++;
         }
 
+#if CONFIG_SMP_NCPUS > 1
+      /* Workaround for SMP:
+       * In multi-core environment, thread_signaler would be excecuted prior
+       * to the thread_waiter, even though priority of thread_signaler is
+       * lower than the thread_waiter. In this case, thread_signaler will
+       * aquire mutex before the thread_waiter aquires it and will show
+       * the error message such as "thread_signaler: ERROR waiter state...".
+       * To avoid this situaltion, we add the following usleep()
+       */
+
+      usleep(10 * 1000);
+#endif
+
       signaler_nloops++;
     }