using CRITICAL_SECTION if _MSC_VER defined.