Fix and optimize @synchronize on Win32.