Rockbox mail archiveSubject: RE: 3 patches
RE: 3 patches
From: Peter D'Hoye <peter.dhoye_at_telenet.be>
Date: Tue, 13 Dec 2005 23:14:36 +0100
> > In the yield() implementation I've added a mechanism that
> > alternates between Sleep(0) and Sleep(1). This is because
> > Sleep(1) makes the app run too slow (no audio), and Sleep(0)
> > hogs the CPU (but gives sound).
> > I wrote it so that it calls Sleep(1) every 256 calls to
> > yield. All other times it does Sleep(0).
> I'll give it a go, but I've noticed that the yield()
> implementation is
> tricky to get right. I guess it depends a lot on how often yield() is
> called from the rest of Rockbox.
I noticed that, so that's what my solution tries to fix.
problem: there are _many_ yield() calls. So putting a Sleep(1) in
the implementation slows down the sim _a_lot_.
But if you only do Sleep(0), you get 100% CPU.
So the solution is simple: alternate Sleep(0) with Sleep(1) and get the best
of both worlds.
After some experimenting, a 1/256 dutycycle gave a good result, so I
And sorry for the <cr><lf> line-endings in my patch, I'll get a tool to get
rid of those...
Received on 2005-12-13