YafaRay/Core — pull request #62 by DavidBluecame (2013-04-03 19:06:12+00:00)
Title: Fixed hangs and crashes in Linux

To fix issue: http://www.yafaray.org/node/318

** Needs to be tested in Windows systems **

The problem in Linux was that threads that had already ended (running=0) were not joined, so their resources were not released and eventually the stack was full.

However, we cannot use the pthreads_join in the thread object destructor, as the object could be destroyed before the thread is ended and joined.

So, I had to change the code in integrator.cc so, instead of just deleting the thread objects, first we have to wait and then destroy. This could affect Windows systems, so testing is advised to ensure they are ok.

I had also to modify the thread wait() function to ensure the thread is joined regardless is running or not.