[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Sleep
- From: Steven Johnson <steve@...>
- Date: Wed, 13 Oct 2010 17:20:32 -0500
On Wed, Oct 13, 2010 at 4:15 PM, Henning Diedrich <firstname.lastname@example.org> wrote:
> Sounds good. But if there is nothing else to do it would still busy the
> system I guess?
> On 10/13/10 8:58 PM, Steven Johnson wrote:
> Can you run your game tick in a coroutine? If so, you can mitigate the
> busy-ness of the loop by interspersing yield() calls.
Well, you'll have to drive the coroutine each frame (via resume() or
calling a wrap()'d function), so you can still check your input / stop
updates between doing that.
But I realize now that I misunderstood the problem, as my suggestion
only abstracts how you wait. It just moves the burden of where you do
the Sleep() around a little bit. Sorry for the noise.