Re: [AD] proposal: al_sleep() |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
On Fri, 2004-01-02 at 12:55, Stepan Roh wrote: > 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. The attached patch implements that. I tried doing it for all platforms except the old mac port. Only tested on linux with pthreads so far. Modified examples/GUI will follow in case it is accepted. -- Elias Pschernig <elias@xxxxxxxxxx>
Attachment:
al_sleep.diff.gz
Description: GNU Zip compressed data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |