--- a/src/raytracer.cc Sat Nov 17 17:47:06 2007 +0100
+++ b/src/raytracer.cc Sun Nov 18 11:20:56 2007 +0100
@@ -205,6 +205,7 @@
#ifdef PTHREADS
pthread_exit((void *)d);
#endif
+ return (void *)d;
}
float *Raytracer::render(int w, int h)
@@ -229,11 +230,11 @@
vy = starty;
#ifdef PTHREADS
- int num_threads = 20;
+ int num_threads = 2;
printf("* pthreads enabled, using %d threads\n", num_threads);
pthread_t threads[num_threads];
for (int t = 0; t < num_threads; t++)
- threads[t] = 0;
+ threads[t] = pthread_self();
int t = 0;
#endif
@@ -260,7 +261,7 @@
t = 0;
/* wait for next thread in fifo queue, so the descriptor can be reused;
this also limits number of running threads */
- if (threads[t] != 0)
+ if (!pthread_equal(threads[t], pthread_self()))
if (pthread_join(threads[t], (void**)&d) == 0)
free(d);
#else