Re: [AD] proposal: al_sleep() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Fri, 2004-01-02 at 16:26, aj wrote:
> before we go on,
>
> is al_sleep(0) going to win32::Sleep(>0); ????
>
Sleep(1) probably. The way I wanted to do at first was, al_sleep(0)
would do Sleep(0) and al_sleep(1) would do Sleep(1). The problem is,
some platforms sleep longer than 1 ms in yield_timeslice. But the only
reason for al_sleep is cross-platform portability - otherwise, the
#defines I'm currently using (and probably anyone else who sees that
yield_timeslice does nothing) would do as well.
So, there should be a way to just give up the current time-slice.
al_sleep(1) can't be used, since it tries to sleep at least 1 ms (which,
with some schedulers, doesn't seem to do much?). Therefore, al_sleep(0)
will mean: sleep as few time as possible, but at least sleep. Force the
idle thread to become active. Under Windows, this means, Sleep(1). Under
unix, it will just always use the non-sched_yield version of
yield_timeslice. Everywhere else I'll just copy yield_timeslice -
assuming the authors of the other ports knew why they were using greater
values.
Oh, and I'm still hoping for someone to step in and agree with my view
on yield_timeslice() - so there would be no al_sleep at all :) Although
I can see now why yield_timeslice was added, I still can't think of any
Allegro program where I would want to call yield_timeslice, with the
current meaning of it. And of course it would mean changing the
functionality of a function - but since this functionality isn't
guaranteed (it says "platforms which support it") - nothing can break
anyway :)
--
Elias Pschernig <elias@xxxxxxxxxx>