tests: fix incorrect counter
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 15 May 2013 14:26:57 +0000 (16:26 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 15 May 2013 14:26:57 +0000 (16:26 +0200)
- not initialized to 0 in 2 tests,
- within inner loop in 3rd test, thus always 0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/test_urcu_lfs.c
tests/test_urcu_wfcq.c
tests/test_urcu_wfs.c

index 67ccaa25f3f9911e77acbc22d62f43ba6d84ed1c..9636f5bb0da7a935f3e52092d0b3cbef1278cea8 100644 (file)
@@ -274,6 +274,7 @@ void do_test_pop_all(enum test_sync sync)
 static void *thr_dequeuer(void *_count)
 {
        unsigned long long *count = _count;
+       unsigned int counter = 0;
 
        printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
                        "dequeuer", (unsigned long) pthread_self(),
@@ -291,8 +292,6 @@ static void *thr_dequeuer(void *_count)
        assert(test_pop || test_pop_all);
 
        for (;;) {
-               unsigned int counter = 0;
-
                if (test_pop && test_pop_all) {
                        /* both pop and pop all */
                        if (counter & 1)
index cb1cc23ed91aa575ea9667a4594ec9269dc3b1b6..a3bd7e556031eef71c19b1be5e811ae5daaebdf6 100644 (file)
@@ -285,7 +285,7 @@ static void do_test_splice(enum test_sync sync)
 static void *thr_dequeuer(void *_count)
 {
        unsigned long long *count = _count;
-       unsigned int counter;
+       unsigned int counter = 0;
 
        printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
                        "dequeuer", (unsigned long) pthread_self(),
index a379fa39176c9453f1249748da21409b08e4c92f..043d842e73b5a4b93c9b462120add91bae1c5e23 100644 (file)
@@ -270,7 +270,7 @@ static void do_test_pop_all(enum test_sync sync)
 static void *thr_dequeuer(void *_count)
 {
        unsigned long long *count = _count;
-       unsigned int counter;
+       unsigned int counter = 0;
 
        printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
                        "dequeuer", (unsigned long) pthread_self(),
This page took 0.026247 seconds and 4 git commands to generate.