コード例 #1
0
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;
}
コード例 #2
0
int ioRelinquishProcessorForMicroseconds(int microSeconds) {
	/* This operation is platform dependent. 	 */

    long	   realTimeToWait,now;
	extern int getNextWakeupTick();

    now = (ioMSecs() & MillisecondClockMask);
    if (getNextWakeupTick() <= now)
        if (getNextWakeupTick() == 0)
            realTimeToWait = microSeconds;
        else {
            return 0;
    }
    else
        realTimeToWait = (getNextWakeupTick() - now) * 1000; 

	aioSleepForUsecs(realTimeToWait);

	return 0;
}
コード例 #3
0
ファイル: sqrUnixMain.c プロジェクト: bhatti/RoarVM
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;
}