コード例 #1
0
ファイル: getch.cpp プロジェクト: DinrusGroup/DinrusUcrtBased
// 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;
}