Fixed hangs and crashes in Linux

To fix issue: http://www.yafaray.org/node/318

In Linux, when using multiple threads, the missing pthread_join line caused memory leak and eventually filled up the thread stack, causing EAGAIN errors in newly created threads and therefore a complete hang of Yafaray and Blender after rendering several frames.

Still with that fix, Photon Mapping still caused random crashes and segfaults, so I have increased the pthread stack size and it seems to have solved the issue.
Fixes for Black Dots

This fixes several Black Dots situations where NaN appear in the color calculations. Apparently this can be caused by two circumstances:
* Usage of 32bit float numbers within 64bit double acos() functions.
* Sometimes, for some reason, the input to the acos() function is very slightly outside of the [-1,1] domain, causing a NaN. Perhaps that could be caused by the normal accumulative 32bit float calculation errors?

Therefore, I have done several modifications in the Core code to use, instead of the standard double acos() funcion, an inline fAcos() function defined both as a float and as a double, depending on the type of number being used.
* I have also added runtime-checks of the domain validity. If the input number is outside the domain, it's considered as being at the end of the domain. For example, -1.0001 would be considered as -1.0 for the acos calculation.
* I have used acosf() instead of acos() for the 32bit floating point numbers. That also caused problems when the input 32bit number was at the exremes of the domain.
Merge pull request #56 from DavidBluecame/blackdots_fixes_trig

Fixes for Black Dots
Merge pull request #57 from DavidBluecame/linux_fix_crashes

Fixed hangs and crashes in Linux
Add fix for use MinGW GCC 4.7.1 compiler
Blackdots fix change requested by DarkTide-
Now the domain checks are also performed when FAST-MATH=ON
Also, no need to differentiate acos() and acosf() as for C++ acos() it's an overloaded function and should work for float and double