Fix compile error for cygwin1.7.18, add check __CYGWIN__ macro.

Patch other method.
I tested, all green.