Re: gtk main and slemr main
- From: Havoc Pennington <hp redhat com>
- To: Matt Eisemann <meisemann dsrnet com>
- Cc: "'otaylor redhat com'" <otaylor redhat com>, "'gtk-list gnome org'" <gtk-list gnome org>
- Subject: Re: gtk main and slemr main
- Date: 08 Oct 2000 19:07:12 -0400
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.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]