extern "C" int __cdecl _getche() { __acrt_lock(__acrt_conio_lock); int result = 0; __try { result = _getche_nolock(); } __finally { __acrt_unlock(__acrt_conio_lock); } return result; }
int __cdecl _getche ( void ) { int ch; _mlock(_CONIO_LOCK); /* secure the console lock */ __TRY ch = _getche_nolock(); /* input and echo the character */ __FINALLY _munlock(_CONIO_LOCK); /* unlock the console */ __END_TRY_FINALLY return ch; }