mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Simplified yield() in the Win32 simulator. Now only hogs the CPU during playback, and playback doesn't stutter that much.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8143 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f9fa33f691
commit
11b2ade5c8
1 changed files with 1 additions and 15 deletions
|
|
@ -33,22 +33,8 @@ CRITICAL_SECTION CriticalSection;
|
|||
|
||||
void yield(void)
|
||||
{
|
||||
static clock_t last = 0;
|
||||
clock_t now;
|
||||
|
||||
LeaveCriticalSection(&CriticalSection);
|
||||
/* Don't call Sleep() too often (as the smallest sleep really is a bit
|
||||
* longer). This keeps CPU usage low, yet allows sound playback to work
|
||||
* well (at least on one particular computer).
|
||||
*/
|
||||
now = clock();
|
||||
|
||||
if (now - last > CLOCKS_PER_SEC / 200)
|
||||
{
|
||||
last = now;
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
EnterCriticalSection(&CriticalSection);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue