Module: xenomai-3
Branch: stable-3.0.x
Commit: c9bdf48a9c3d788cd4933462fc301aa02d759b36
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c9bdf48a9c3d788cd4933462fc301aa02d759b36

Author: Josh Bowman <jbow...@facts-inc.com>
Date:   Sat Apr  1 11:07:05 2017 +0200

testsuite/latency: prevent access to stale semaphore during cleanup

Wait for the display task to exit before deleting the semaphore it
pends on.

---

 testsuite/latency/latency.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index e800361..5304342 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -492,6 +492,8 @@ static void cleanup(void)
        if (test_mode == USER_TASK) {
                pthread_cancel(latency_task);
                pthread_join(latency_task, NULL);
+               pthread_join(display_task, NULL);
+
                sem_close(display_sem);
                sem_unlink(sem_name);
                gavgjitter /= (test_loops > 1 ? test_loops : 2) - 1;
@@ -504,10 +506,9 @@ static void cleanup(void)
                gmaxjitter = overall.result.max;
                gavgjitter = overall.result.avg;
                goverrun = overall.result.overruns;
+               pthread_join(display_task, NULL);
        }
 
-       pthread_join(display_task, NULL);
-
        if (benchdev >= 0)
                close(benchdev);
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to