Vlado multithreading

This is a preview of the changes that we did to improve multithreaded Ptex rendering with V-Ray. The code will not compile as it is, since it relies on two threading primitives provided by the V-Ray SDK:

*) A recursive spin lock (only used on Linux/Mac OS; on Windows, the OS-provided critical sections are fast enough)
*) A non-recursive read/write spin lock based on atomic integer operations

Implementations for both primitives are readily available in the internet but require compiler or OS-specific code for Windows/Linux/Mac OS X.