[LAD] alsa sequencer and sysex editing

rdxesy at yahoo.de rdxesy at yahoo.de
Mon Jun 2 17:32:16 UTC 2008


On Mon, Jun 02, 2008 at 18:33:08 +0200
Fons Adriaensen <fons at kokkinizita.net> wrote:
> On Mon, Jun 02, 2008 at 06:13:26PM +0200, rdxesy at yahoo.de wrote:
> 
> > My question is: how would I make sure to catch all answers 
> > from the device without using a thread and without just 
> > waiting for an constant time before I check if there is an 
> > answer( which is alo not very fail save, a message might 
> > take a little longer if there is traffic on the midibus)?
> 
> There seem to be two ways: either you make the read blocking
> (which will prevent you from doing anything until a reply
> arrives), or use a separate thread to read (again blocking).
> 
> For apps handling async events using threads is really the
> 'natural' thing to do. If multithreading is new to you, now
> is the time to jump into it !

Ciao,

thank you for that info. The problem with that thread
approach is that i cannot call gtk_* stuff from it (which
is needed, as most answers are values that will be used to
set sliders, comboboxes and spinbuttons).
I could use g_idle_add or g_timeout_add for that thread but
that adds another async layer, and questions like "what
would be the timeout"?
Is there a way to call a function in the main loop from a
thread "now and once" (i mean, without using
g_idle/timeout_add, something thats just like a call to a
"normal" function but calls it in the main loop)?

Thank you.

Jan



More information about the Linux-audio-dev mailing list