On 12 May 2001 [EMAIL PROTECTED] wrote:
> * Applied Matt's patch to unwarnify main.c
> * soundserver_sdl.c now uses SDL's select()-like functions to wait for
> signals
It actually looks like using sci_sched_yield works just as well.
CPU usage of the sound thread never goes above 10% (during song loading, I
guess?), and usually plays/idles around <2%. This is about as good as the
SDL_CondWait* stuff was getting, and should work on Linux/BSD/etc as well.
Attached is a diff that reverts to sci_sched_yield(), since it will work
better across platforms.
Now we just need to fix the main thread trying to use 100% CPU all the
time :)
--
http://www.clock.org/~matt
-- Attached file included as plaintext by Listar --
-- File: soundserver_sdl.c-patch
Index: freesci/src/sound/soundserver_sdl.c
===================================================================
RCS file: /home/cvs/freesci/src/sound/soundserver_sdl.c,v
retrieving revision 1.18
diff -r1.18 soundserver_sdl.c
167a168
>
170,186c171,173
< /* These were attempts to fix CPU usage problem */
< /* sci_sched_yield(); */
< /* usleep(wait_tvp->tv_usec >> 4); */
<
< /* This appears to be the best solution,
< the last parameter is in milliseconds, so we convert */
< ret = SDL_CondWaitTimeout(in_cond, in_mutex,
(wait_tvp->tv_usec >> 10));
<
< if (ret != 0)
< {
< if (ret != SDL_MUTEX_TIMEDOUT)
< {
< fprintf(stderr, "sound_sdl_get_command():
SDL_CondWaitTimeout returned error (%d)\n",ret);
< }
< return NULL;
< }
< }
---
> sci_sched_yield();
> return NULL;
> }