Re: Proper way to provide gtk+ app with asynchronous data?

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

 



>Tristan Van Berkom wrote:
>
>>    Just to point out one of the million possible solutions to this age
>> old problem ('cause I liked this solution alot when I heard of it, I have
>> to admit I haven't had the oportunity to try it myself since), you can
>> create your own GSource that pops off elements from a GAsyncQueue and
>> use that "source" in your recieving thread and in your publishing thread
>> you can push datum on to that queue and call `g_main_context_wakeup()'
>> on the recieving thread's context (ofcourse you can wrap that up in a 
>> pretty
>> little convinient api...).
>
>Could you point to some additional documentation on how to actually 
>create own `GSource`s? An example? I'm stuck with it just because plain 
>glib docs didn't give me understanding of what is what, and google was 
>also successfull in keeping the secret.

just be sure to be aware that this is not a good design if the
data-sending thread is under hard or soft real-time constraints. you
should never force synchronization between the GUI and a real-time
thread, because it can cause the RT thread to block for an unbounded
period. use lock-free techniques (such as single-reader/single-writer
ringbuffers) and/or pipes.

--p
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux