Avoid hangs and memory leak in Linux

In Linux, when using multiple threads, the missing pthread_join caused memory leak and eventually filled up the Thread Stack, causing EGAIN errors in newly created threads and therefore a complete hang of Yafaray and Blender after rendering several frames.