Revision [114]

This is an old revision of ioRelinquishProcessorForMicroseconds made by JohnMcIntosh on 2008-10-14 23:36:39.

 

sqInt ioRelinquishProcessorForMicroseconds(sqInt microSeconds)


Parms: microSeconds, ignore it, it's wrong a constant of 1000
return: NONE, fake return of zero
From: Interpreter
Why:
Make the VM sleep for some milliseconds

Responsibility:
In the past this routine slept for some number of milliseconds, 10, 100? This was wrong
and John McIntosh lobbied to change the logic to sleep until the next wakeup tick.
Then it was noticed we did not service UI or socket events timely. So the aioPoll
call was added to ensure we would wake up if a UI or other interrupt arrived. We
also set setInterruptCheckCounter to zero to indicate that on the next check for interrupts
we should find a Delay to service.

The trade-off here is if sleeping occurs too infrequently, squeak uses too much CPU time to do
nothing. If it sleeps too much then UI performance may suffer (which might not be noticed), or a
delay might not get serviced in a timely fashion (interesting side-effects), or a socket connection not serviced, that can be noticed
by Seaside.

Developers should carefully consider the trade off between sleeping and timely waking. Note that Morphic wants to wake up every 16 milliseconds to do nothing so there is always a pending delay, however pre-morphic the next wakeup time could have been zero?

MacIntosh
Follows unix implementation. uses nano-sleep
os-9/OSXCarbon
Follows unix implementation. uses nano-sleep
Cocoa:
TBD

iPhone
Follows unix implementation. uses nano-sleep

Unix
Without Nano-sleep it seems to sleep for 10 ms.

Windows

BUGS
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki