--- a/Makefile Sat Nov 17 17:47:06 2007 +0100
+++ b/Makefile Sun Nov 18 11:20:56 2007 +0100
@@ -1,12 +1,12 @@
-CCFLAGS=-Wall -Wno-write-strings -O3 -I./src -DPTHREADS -pthread -fno-strict-aliasing
+CCFLAGS=-I./src -Wall -Wno-write-strings -O3 -fno-strict-aliasing -DPTHREADS
LDFLAGS=
ifeq ($(OS), Windows_NT)
CCFLAGS+=-I"C:/Program Files/Python25/include"
- LDFLAGS+=-L"C:\Program Files\Python25\libs" -lpython25
+ LDFLAGS+=-L"C:\Program Files\Python25\libs" -lpython25 -lpthreadGC2
MODULENAME=raytracer.pyd
else
- CCFLAGS+=-fPIC `python-config --includes`
+ CCFLAGS+=-pthread -fPIC `python-config --includes`
MODULENAME=raytracermodule.so
endif
--- a/README Sat Nov 17 17:47:06 2007 +0100
+++ b/README Sun Nov 18 11:20:56 2007 +0100
@@ -9,3 +9,6 @@
To completely disable this feature just remove "-DPTHREADS -pthreads"
from flags in makefile.
+
+For Windows + Mingw32, get pthreads library here:
+http://sources.redhat.com/pthreads-win32/
--- a/TODO Sat Nov 17 17:47:06 2007 +0100
+++ b/TODO Sun Nov 18 11:20:56 2007 +0100
@@ -1,4 +1,3 @@
- * pthreads for Windows: http://sources.redhat.com/pthreads-win32/
* kd-tree
--- a/demos/demo.py Sat Nov 17 17:47:06 2007 +0100
+++ b/demos/demo.py Sun Nov 18 11:20:56 2007 +0100
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-sys.path.append("../")
+sys.path.append("..")
from raytracer import Raytracer, Material, Plane, Sphere, Light
#, SphericalLight
--- a/demos/spheres_ao.py Sat Nov 17 17:47:06 2007 +0100
+++ b/demos/spheres_ao.py Sun Nov 18 11:20:56 2007 +0100
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-sys.path.append("../")
+sys.path.append("..")
from raytracer import Raytracer, Material, Plane, Sphere, Light
import Image
--- a/demos/spheres_shadow.py Sat Nov 17 17:47:06 2007 +0100
+++ b/demos/spheres_shadow.py Sun Nov 18 11:20:56 2007 +0100
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-sys.path.append("../")
+sys.path.append("..")
from raytracer import Raytracer, Material, Plane, Sphere, Light
import Image
--- a/demos/triangles_monkey.py Sat Nov 17 17:47:06 2007 +0100
+++ b/demos/triangles_monkey.py Sun Nov 18 11:20:56 2007 +0100
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-sys.path.append("../")
+sys.path.append("..")
from raytracer import Raytracer, Light, Sphere, Triangle, Material
import Image
--- a/demos/triangles_sphere.py Sat Nov 17 17:47:06 2007 +0100
+++ b/demos/triangles_sphere.py Sun Nov 18 11:20:56 2007 +0100
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-sys.path.append("../")
+sys.path.append("..")
from raytracer import Raytracer, Light, Sphere, Triangle, Material
import Image
--- 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