From f459beb7f9ad44f4441af774dc21c3ca8136fd08 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Sep 2008 12:11:27 +0100 Subject: [PATCH] do not have threads at all if NPROCESSORS=1 --- parallel.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/parallel.c b/parallel.c index 3c94607..a79a370 100644 --- a/parallel.c +++ b/parallel.c @@ -20,6 +20,7 @@ typedef struct { pthread_t thread; } PerThread; +#if NPROCESSORS != 1 static void *routine(void *thread_v) { PerThread *t= thread_v; ForAllThreads *a= t->allthreads; @@ -28,6 +29,7 @@ static void *routine(void *thread_v) { return 0; } +#endif void inparallel(const struct Vertices *vertices, Computation *separately, @@ -37,14 +39,15 @@ void inparallel(const struct Vertices *vertices, ForAllThreads allthreads; SecData secdatas[nsections]; - PerThread threads[nsections]; - - int s, r; allthreads.vertices= vertices; allthreads.separately= separately; allthreads.gendata= gendata; +#if NPROCESSORS != 1 + PerThread threads[nsections]; + int s, r; + for (s=0; s