On Mon, Jun 02, 2008 at 21:55:30 +0200
Fons Adriaensen <fons(a)kokkinizita.net> wrote:
On Mon, Jun 02, 2008 at 07:32:16PM +0200,
rdxesy(a)yahoo.de wrote:
Other solutions are:
- Use a separate thread to read the midi data, then send
it as an X event (you can make 'user' event types) to your
main window. Doing this will trigger the GTK loop.
- Use a separate thread, and a mutex used by this thread
and the GTK loop to avoid concurrent access to data and
mixed-up X-calls.
Ciao,
i use the mutex solution since tha fits well into the
existing code "). So, I have a thread that polls the
incoming queue in an endless loop:
while(1)
...
midi_callback()
}
and this function:
midi_callback(void)
{ ...
gdk_threads_enter ();
/* do the slider dance */
gdk_threads_leave ();
...
}
works and i am happy as the gui feedback is almost instant
now. ")
Cheers,
Jan