sqInt ioRelinquishProcessorForMicroseconds(sqInt microSeconds) { //API Documented /* This operation is platform dependent. */ #pragma unused(microSeconds) sqInt realTimeToWait,now,next; extern sqInt getNextWakeupTick(void); //This is a VM Callback extern sqInt setInterruptCheckCounter(sqInt value); //This is a VM Callback setInterruptCheckCounter(0); now = ioMSecs(); next = getNextWakeupTick(); /*BUG??? what if clock wraps? */ if (next <= now) if (next == 0) realTimeToWait = 16; else { return 0; } else realTimeToWait = next - now; aioSleep((int) realTimeToWait*1000); return 0; }
static void recordKeystroke(int keyCode) /* DEPRECATED */ { if (inputEventSemaIndex == 0) { int keystate= keyCode | (modifierState << 8); # ifdef DEBUG_EVENTS printf("RECORD keystroke"); printModifiers(modifierState); printKey(keyCode); printf(" = %d 0x%x\n", keystate, keystate); # endif if (keystate == getInterruptKeycode()) { setInterruptPending(true); setInterruptCheckCounter(0); } else { keyBuf[keyBufPut]= keystate; keyBufPut= (keyBufPut + 1) % KEYBUF_SIZE; if (keyBufGet == keyBufPut) { /* buffer overflow; drop the last character */ keyBufGet= (keyBufGet + 1) % KEYBUF_SIZE; keyBufOverflows++; } } } }
sqInt ioRelinquishProcessorForMicroseconds(sqInt microSeconds) { yield(); int now; now = ioMSecs(); if (now - lastInterruptCheck > (1000/25)) { /* avoid thrashing intr checks from 1ms loop in idle proc */ setInterruptCheckCounter(-1000); /* ensure timely poll for semaphore activity */ lastInterruptCheck = now; } return 0; }
sqInt ioRelinquishProcessorForMicroseconds(sqInt us) { int now; dpy->ioRelinquishProcessorForMicroseconds(us); now= ioLowResMSecs(); if (now - lastInterruptCheck > (1000/25)) /* avoid thrashing intr checks from 1ms loop in idle proc */ { setInterruptCheckCounter(-1000); /* ensure timely poll for semaphore activity */ lastInterruptCheck= now; } return 0; }
sqInt ioRelinquishProcessorForMicroseconds(sqInt us) { int nwt= getNextWakeupTick(); int ms= 0; if (nwt) { int now= (ioMSecs() & 0x1fffffff); ms= ((nwt <= now) ? (1000/60) : nwt - now); } dpy->ioRelinquishProcessorForMicroseconds(ms*1000); setInterruptCheckCounter(0); return 0; }