dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: RE: 3 patches

RE: 3 patches

From: Peter D'Hoye <>
Date: 2005-12-13


> > 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
implemented that.

And sorry for the <cr><lf> line-endings in my patch, I'll get a tool to get
rid of those...

Received on Tue Dec 13 23:15:07 2005

Page was last modified "Jan 10 2012" The Rockbox Crew