clean tests
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Wed, 15 Oct 2025 17:28:03 +0000 (19:28 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Wed, 15 Oct 2025 17:28:03 +0000 (19:28 +0200)
clock.c
cycle.c
thread_c+j.c
thread_c.c

diff --git a/clock.c b/clock.c
index f21e5b75ffc669ca60b8b1be539eeec287e6ee23..5da792ccf3d57054bdf632b9447e05d338df0772 100644 (file)
--- a/clock.c
+++ b/clock.c
@@ -14,7 +14,6 @@
 
 dts_t *deltas = NULL;
 int nb_measurements = 0;
-pthread_mutex_t *mutex = NULL;
 
 char *message = "Clock accurency";
 void (*usage_ext) (FILE *) = NULL;
@@ -26,14 +25,13 @@ int rc = 0;
 #define MAXDUR 1000
 #define MINDUR 100
 
-int init (dts_t *buffer, int nb, pthread_mutex_t *synchro)
+int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro)
 {
 
     /* set global variables */
 
     deltas = buffer;
     nb_measurements = nb;
-    mutex = synchro;
 
     return 0;
 }
@@ -41,8 +39,6 @@ int init (dts_t *buffer, int nb, pthread_mutex_t *synchro)
 void *ping (__attribute__((unused)) void *arg)
 {
 
-    pthread_mutex_unlock (mutex);
-
     for (int i = 0; i < nb_measurements; i++) {
 
         int duration = MINDUR * ((MAXDUR / MINDUR) * rand () / RAND_MAX);
@@ -59,7 +55,6 @@ void *ping (__attribute__((unused)) void *arg)
 
 void *pong (__attribute__((unused)) void *arg)
 {
-    pthread_mutex_unlock (mutex);
     pthread_exit (NULL);
 }
 
diff --git a/cycle.c b/cycle.c
index bd3c4842ea58ac3871d1227d9e32c9dfb172324e..f81c7ab84f5a137f346658a355b4c86df7798c9b 100644 (file)
--- a/cycle.c
+++ b/cycle.c
@@ -14,7 +14,6 @@
 
 dts_t *deltas = NULL;
 int nb_measurements = 0;
-pthread_mutex_t *mutex = NULL;
 
 char *message = "Cycle latency";
 void (*usage_ext) (FILE *) = NULL;
@@ -26,14 +25,13 @@ int rc = 0;
 #define MAXDUR 1000
 #define MINDUR 100
 
-int init (dts_t *buffer, int nb, pthread_mutex_t *synchro)
+int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro)
 {
 
     /* set global variables */
 
     deltas = buffer;
     nb_measurements = nb;
-    mutex = synchro;
 
     return 0;
 }
@@ -41,8 +39,6 @@ int init (dts_t *buffer, int nb, pthread_mutex_t *synchro)
 void *ping (__attribute__((unused)) void *arg)
 {
 
-    pthread_mutex_unlock (mutex);
-
     for (int i = 0; i < nb_measurements; i++) {
 
         int duration = MINDUR * ((MAXDUR / MINDUR) * rand () / RAND_MAX);
@@ -59,7 +55,6 @@ void *ping (__attribute__((unused)) void *arg)
 
 void *pong (__attribute__((unused)) void *arg)
 {
-    pthread_mutex_unlock (mutex);
     pthread_exit (NULL);
 }
 
index 5b752b0580b1e1071469b3d348a223d42a6c4629..179c8343491b1b142796b1e9f5722fddc4e5e836 100644 (file)
@@ -12,7 +12,6 @@
 
 dts_t *deltas = NULL;
 int nb_measurements = 0;
-pthread_mutex_t *mutex = NULL;
 
 char *message = "Thread (create and join) latency";
 void (*usage_ext) (FILE *) = NULL;
@@ -20,14 +19,13 @@ int (*parse_arg_ext) (char *) = NULL;
 
 int rc = 0;
 
-int init (dts_t *buffer, int nb, pthread_mutex_t *synchro)
+int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro)
 {
 
     /* set global variables */
 
     deltas = buffer;
     nb_measurements = nb;
-    mutex = synchro;
 
     return 0;
 }
@@ -40,8 +38,6 @@ void* dummy_thread (__attribute__((unused)) void *arg)
 void *ping (__attribute__((unused)) void *arg)
 {
 
-    pthread_mutex_unlock (mutex);
-
     for (int i = 0; i < nb_measurements; i++) {
 
         ts_t ts1;
@@ -67,7 +63,6 @@ void *ping (__attribute__((unused)) void *arg)
 
 void *pong (__attribute__((unused)) void *arg)
 {
-    pthread_mutex_unlock (mutex);
     pthread_exit (NULL);
 }
 
index 637c526271f80a62cb5a7aef0bce6bf6ba9e59c2..573b0723c7268a9eb9a4f60a067ed384b40447fc 100644 (file)
@@ -12,7 +12,6 @@
 
 dts_t *deltas = NULL;
 int nb_measurements = 0;
-pthread_mutex_t *mutex = NULL;
 
 char *message = "Thread (create) latency";
 void (*usage_ext) (FILE *) = NULL;
@@ -21,14 +20,13 @@ int (*parse_arg_ext) (char *) = NULL;
 ts_t ts1, ts2;
 int rc = 0;
 
-int init (dts_t *buffer, int nb, pthread_mutex_t *synchro)
+int init (dts_t *buffer, int nb, __attribute__((unused)) pthread_barrier_t *synchro)
 {
 
     /* set global variables */
 
     deltas = buffer;
     nb_measurements = nb;
-    mutex = synchro;
 
     return 0;
 }
@@ -42,8 +40,6 @@ void* dummy_thread (__attribute__((unused)) void *arg)
 void *ping (__attribute__((unused)) void *arg)
 {
 
-    pthread_mutex_unlock (mutex);
-
     for (int i = 0; i < nb_measurements; i++) {
 
         sys_timestamp (&ts1);
@@ -65,7 +61,6 @@ void *ping (__attribute__((unused)) void *arg)
 
 void *pong (__attribute__((unused)) void *arg)
 {
-    pthread_mutex_unlock (mutex);
     pthread_exit (NULL);
 }