pthread_t thread;
} PerThread;
+#if NPROCESSORS != 1
static void *routine(void *thread_v) {
PerThread *t= thread_v;
ForAllThreads *a= t->allthreads;
return 0;
}
+#endif
void inparallel(const struct Vertices *vertices,
Computation *separately,
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<nsections; s++) {
threads[s].allthreads= &allthreads;
threads[s].section= s;
if (r) diee("pthread_join");
combine(vertices, s, threads[s].secdata, gendata);
}
+#else
+ separately(vertices, 0, &secdatas[0], gendata);
+ combine(vertices, 0, &secdatas[0], gendata);
+#endif
}