Re: [AD] proposal: al_sleep()

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


On Fri, 2 Jan 2004, Elias Pschernig wrote:

> > > Just modifying yield_timeslice (and updating the docs) seems to be the
> > > most simple thing to do, with no need to introduce a new function.
> >
> > I still don't think it is needed at all - just make al_sleep(0) (=
> > yield_timeslice()) sleep at most al_sleep(1) (or don't sleep at all and
> > use sched_yield() or eq.). Or leave yield_timeslice() alone and make
> > al_sleep(0) sleep the shortest possible time on given platform and let
> > user decide if it wants non-blocking or blocking CPU release. I think
> > that's the way:
> >
> > 1. leave yield_timeslice() as is
> > 2. make al_sleep(0) sleep the shortest possible time on each platform (it
> > is sleep so it should sleep)
> > 3. make al_sleep(x) sleep at least x miliseconds (or what units you have)
> >
> > In this case al_sleep() should look like:
> >
> > if (!x) { sys_sleep(SYS_MIN_SLEEP); } else { sys_sleep(sys_recalc(x)); }
> >
>
> Ok, makes sense. (Of course, my next step will then be to replace
> yield_timeslice with al_sleep(0) in the GUI and examples so they use
> less CPU and look nicer to users.. :)

Yes, that was what I had on my mind.

Have a nice day.

Stepan Roh




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