for (i=0; i<no_pairs; ){
for (j=0; j<MAX_THREADS && i<no_pairs; j++,i++){
data[j].a = seeds[i/no_seeds];
data[j].b = seeds[i%no_seeds];
data[j].N = N;
data[j].L = nones+nzeros;
data[j].p1 = get_string (seeds[i/no_seeds], nzeros
+nones-1);
data[j].p2 = get_string (seeds[i%no_seeds], nzeros
+nones-1);
data[j].results = pairs[i];
rc = pthread_create (&threads[j], &attr, run_actree,
(void*)&data[j]);
if (rc) {
printf ("ERROR; return code from pthread_create() is %d
\n", rc);
exit (-1);
}
}
for (k=0; k<j; k++){
rc = pthread_join (threads[k], &status);
if (rc) {
printf("ERROR; return code from pthread_join() is %d
\n", rc);
exit(-1);
}
}
}
pthread_attr_destroy (&attr);
Above is the main loop i create threads in, MAX_THREADS = 24
the number of pairs is about 300 million, the above code worked
correctly (or atleast the results seemed correct and there were no
errors) for 2 million pairs.
Whether or not this should work, why would someone want to do
something so horribly awful?
DS
anyways barcelona won the champiions league hurray!!
and sorry for wasting your time with this post :)
> LOL because its my work :)
I don't see why that requires you to create and destroy threads rather
than reusing them.
DS