resolve permission issue on _cpy_
reduce time wait for clean_thread quit
fix build issue on Cygwin