Re: [AD] yield_timeslice

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Elias Pschernig wrote:

On Thu, 2004-03-18 at 02:58, Chris wrote:

Elias Pschernig wrote:

No, since if yield_timeslice gets deprecated or re-introduced with the
4.1.12 behavior, it would be replaced by al_idle throughout the Allegro
source. (That's the point of al_idle - making Allegro programs,
especially Allegro itself, not hog all the CPU when being idle.)

And the problem with that is...?


That you can't call rest(1) from al_idle as you said, but the other way
around :)

I'm not sure I'm following. The way I see it, rest currently calls yield_timeslice, and would continue to do so, unless the system driver has a rest method. The rest method would implement cpu/process idling if the system supports it. Thus, al_idle would call rest(1) which would (if the system driver supports it) call the driver's rest method, that would idle the Allegro program, or else it would attempt to just continuously yield the timeslice and give other processes as much cpu as possible. A small chart:

yield_timeslice() -> Yield the current timeslice, return asap.
al_idle() -> rest(1) -> if(system can idle) -> idle process for 1ms
                       else -> yield cpu for 1ms

al_idle would, at the very least, yield itself to other programs so it wouldn't hog the cpu (though this wouldn't explicitly drop the program's cpu usage, it would still be suspending itself so other programs can take the cpu usage they need), or if the system can, actually idle itself. The two main targets, Windows and Unix, should be able to idle without a problem. The other platforms, assuming they're able, will when someone finds the code to do it and writes a proper rest method.

- Kitty Cat




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/