|
From: <sv...@va...> - 2008-02-24 18:18:19
|
Author: bart
Date: 2008-02-24 18:18:23 +0000 (Sun, 24 Feb 2008)
New Revision: 7438
Log:
Various minor changes.
Modified:
trunk/exp-drd/tests/pth_barrier.c
Modified: trunk/exp-drd/tests/pth_barrier.c
===================================================================
--- trunk/exp-drd/tests/pth_barrier.c 2008-02-24 18:16:56 UTC (rev 7437)
+++ trunk/exp-drd/tests/pth_barrier.c 2008-02-24 18:18:23 UTC (rev 7438)
@@ -39,6 +39,8 @@
/* 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 @@
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 @@
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 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);
|