Re: [AD] rest and yield_timeslice

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


On Sat, 2004-07-17 at 03:17 -0700, Chris wrote:
> > 
> > I second all this.
> 
> I third most of this. I agree yield_timeslice should be reverted to the 
> old behavior of actually yielding, as well rest should give up the cpu 
> while waiting.
> 
> However, I don't agree that rest(0) should yield the timeslice. IMO, 
> rest(0) should just return immediately since that's what one would 
> expect.. rest for 0ms (eg. not rest). The rest function has never been 
> directly related to the system scheduler or timeslice, nor should it. As 
> such, yield_timeslice should not be depricated.
> 
> Giving up the CPU and giving up the timeslice are two seperate things. 
> The former is what you do when you have nothing better to do (ie. let 
> the system idle). The latter is what you do when you want other programs 
> to behave efficiently along side your own program.
> 

Well, not completely separate: If you do rest(x) with x other than 0,
you always yield. Only the case of 0 is special - it would be the only
value where rest(x) doesn't yield. So, my proposal, deprecate
yield_timeslice, and have rest(0) as a special case to do yielding.

We discussed this a bit in #allegro already. The question we came down
to is, what is the better API:

Chris: rest(x) will try to rest x ms, rest(0) will do nothing,
yield_timeslice() will yield, on all platforms.

or

Elias: rest(x) will try to rest x ms, rest(0) will yield, on all
platforms. yield_timeslice() is deprecated in favor of rest(0).

But maybe my opinion is influenced by the fact that I disliked
yield_timeslice from the beginning and would like to see it die :) So,
any more thoughts on this from others?

-- 
Elias Pschernig





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