Re: newbie trap



Ross Clement wrote:
Thanks Tristian and Jan for the answers.

I'm not calling
 while ( gtk_events_pending ())
         gtk_main_iteration ();

from event handlers, they are being called from the main thread. I have
several threads running in my program. Two are the threads created by
PortAudio which read audio data into or out of ring buffers. The output
ring buffer is only written to by the main thread, the input ring buffer
is only written to by the the PortAudio thread. Audio processing is then
done by my main thread.


Interesting, if you are not running a gtk_main() and you are calling:

while ( gtk_events_pending ())
     gtk_main_iteration ();

directly from the audio processing thread then that dramatically changes
things (actually; I couldnt think of a better reason for exposing those
functions from GTK+).

You might consider changing it to do:

/* Prioritize audio processing here */
while ( gtk_events_pending () && audio_probably_wont_skip() )
     gtk_main_iteration ();

Cheers,
                   -Tristan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]