MSVC compatibility - WIN32 is a global definition for all windows compilers, MSVC, MINGW32 and other. It even works for x64 and Itanium...
MSVC compatible unix headers
A void* pointer cannot be used for arithmetic operations in most compilers, because of the size by which it needs to increment/decrement is unknown. We need to define char* in order to increment by measures of 8 bits.
pthread is the unix way of doing threads and mutexes.
I have added a MACRO that uses either CRITICAL_SECTION or pthread_mutex depeneding on whether it's windows or unix.
And because a CRITICAL_SECTION has the bonus of being recursive by default, I've added the recursive attribute to the pthread mutexes.