Fixed pthread and std::mutex being reversed. Added checks for MSVC compilation to override