Re: gtk main and slemr main

Matt Eisemann <meisemann dsrnet com> writes:
> Maybe I don't know a lot about sockets and how 
> they work with tcp/ip and udp/ip but how could I use sockets or 
> gtk_idle_add or some feature since I have two loops which I can not clearly 
> have.
>   gtk_main()
>   middleware_main()
>   I have to keep track of which messages are being sent to me that I 
> registered for on the network in addition to the callbacks for the GTK+ GUI 
> buttons and events there.
>   Any ideas or suggestion are greatly welcome.  Thanks.

What Owen is saying is that you need to make the middleware main loop
a slave to the GTK main loop. Many libraries with main loops provide
hooks that would allow this; essentially the hooks you need are a) the
file descriptors middleware is selecting on and b) a function
middleware_process_events() that's called when there's data on those
file descriptors. Then you connect the file descriptors to the GLib
main loop using g_io_add_watch(), and in the callback for
g_io_add_watch() you call middleware_process_events().

Middleware may have some other kinds of hooks, maybe a simple
middleware_check_events_pending() or the like; that could be made to
work too, perhaps with a custom GLib main loop source instead of using
the IO source.

You might contact the middleware vendor and ask them what features
they have to facilitate this type of thing.


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