Re: [Audacity-devel] Latest CVS is *very* cpu intensive
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Joshua H. <jo...@ha...> - 2002-12-02 20:34:42
|
Dominic Mazzoni <do...@mi...> wrote: > Oops, you're right! > > Luckily that's an easy fix. I just made the worker thread go to sleep > every now and then. My CPU usage dropped from 70% to 0.7% (when > Audacity isn't doing anything). See if it works for you. I think a slightly better fix would be to use a condition variable instead of sleeping. Instead of calling Sleep() wait on the condition variable. Then signal that variable from the other thread when you start playback and each time through the callback. It will take less CPU (since the audio thread won't wake up until the program really needs it) and it will be more responsive since it will wake up immediately instead of by whatever granularity you sleep for. Also, do we need to be declaring shared variables volatile? Josh |