Fix perthreadlock test
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sat, 13 Jun 2009 05:19:33 +0000 (01:19 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sat, 13 Jun 2009 05:19:33 +0000 (01:19 -0400)
segmentation fault when 0 readers due to incorrect mutex array indexing (int vs
long types).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
test_perthreadlock.c

index 7d722314bb91c3a7c6899efa3aac5dcd2ea3fd8c..89cce65be71fbdb8badbebedc936b6611e7dc697 100644 (file)
@@ -185,7 +185,7 @@ void *thr_writer(void *data)
                }
                test_array.a = 0;
                test_array.a = 8;
-               for (tidx = nr_readers - 1; tidx >= 0; tidx--) {
+               for (tidx = (long)nr_readers - 1; tidx >= 0; tidx--) {
                        pthread_mutex_unlock(&per_thread_lock[tidx].lock);
                }
                nr_writes++;
This page took 0.026574 seconds and 4 git commands to generate.