From: Bart Van Assche Date: Sun, 24 Feb 2008 18:18:23 +0000 (+0000) Subject: Various minor changes. X-Git-Tag: svn/VALGRIND_3_4_0~1054 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a51563ace866146a48a36a03d3c3e7147f12e533;p=thirdparty%2Fvalgrind.git Various minor changes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7438 --- diff --git a/exp-drd/tests/pth_barrier.c b/exp-drd/tests/pth_barrier.c index c436c916bd..e0b40a7a13 100644 --- a/exp-drd/tests/pth_barrier.c +++ b/exp-drd/tests/pth_barrier.c @@ -39,6 +39,8 @@ static int s_silent; /* Function definitions. */ /*************************/ +/** Single thread, which touches p->iterations elements of array p->array. + * Each modification of an element of p->array is a data race. */ static void* threadfunc(struct threadinfo* p) { int i; @@ -58,7 +60,7 @@ static void* threadfunc(struct threadinfo* p) return 0; } -/** Multithreaded Gauss-Jordan algorithm. */ +/** Actual test, consisting of nthread threads. */ static void barriers_and_races(const int nthread, const int iterations) { int i; @@ -69,6 +71,9 @@ static void barriers_and_races(const int nthread, const int iterations) t = malloc(nthread * sizeof(struct threadinfo)); array = malloc(iterations * sizeof(array[0])); + if (! s_silent) + printf("&array[0] = %p\n", array); + pthread_barrier_init(&b, 0, nthread); for (i = 0; i < nthread; i++) @@ -95,9 +100,9 @@ int main(int argc, char** argv) int nthread; int iterations; - nthread = (argc > 1) ? atoi(argv[1]) : 2; + nthread = (argc > 1) ? atoi(argv[1]) : 2; iterations = (argc > 2) ? atoi(argv[2]) : 3; - s_silent = (argc > 3) ? atoi(argv[3]) : 0; + s_silent = (argc > 3) ? atoi(argv[3]) : 0; barriers_and_races(nthread, iterations);