예제 #1
0
// Returns nonzero if a keystroke is waiting to be read; otherwise returns zero.
extern "C" int __cdecl _kbhit()
{
    __acrt_lock(__acrt_conio_lock);
    int result = 0;
    __try
    {
        result = _kbhit_nolock();
    }
    __finally
    {
        __acrt_unlock(__acrt_conio_lock);
    }
    return result;
}
예제 #2
0
파일: getch.c 프로젝트: flychen50/clib
int __cdecl _kbhit (
        void
        )
{
        int retval;

        _mlock(_CONIO_LOCK);            /* secure the console lock */
        __TRY
            retval = _kbhit_nolock();           /* determine if a key is waiting */
        __FINALLY
            _munlock(_CONIO_LOCK);          /* release the console lock */
        __END_TRY_FINALLY

        return retval;
}