From: Mathieu Desnoyers Date: Sat, 13 Jun 2009 05:19:33 +0000 (-0400) Subject: Fix perthreadlock test X-Git-Tag: v0.1~154 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f120cc103581d43ab08970222e6e836434b8d765;p=userspace-rcu.git Fix perthreadlock test segmentation fault when 0 readers due to incorrect mutex array indexing (int vs long types). Signed-off-by: Mathieu Desnoyers --- diff --git a/test_perthreadlock.c b/test_perthreadlock.c index 7d72231..89cce65 100644 --- a/test_perthreadlock.c +++ b/test_perthreadlock.c @@ -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++;