Re: Moving main loop to GLib.




Aaron Digulla <digulla@wi-pc44.fh-konstanz.de> writes:

> Quoting Owen Taylor (otaylor@redhat.com):
> 
> > To run the main loop, we use the following interface.
> > The main difference for this is that run() and quit()
> > are done for a specific GMainLoop *, instead of
> > for the current main loop. This avoids the problem
> > one occasionally sees where one has a main window and
> > a dialog up, one quits the main window, and the dialog
> > stays up until you quit it.
> 
> This looks good *if* it means that it is possible to write code which
> calls the mainloop when I need it. This is one of the biggest obstacles
> in Xt/Tcl/Gtk+ right now: You can't write your own mainloop to do your
> own thing (eg. I have a thread system and my own global lock to protect
> non-concurrent parts; it must then be possible to use this lock when
> waiting for events). Is that possible with this approach ?

I'm not sure what exactly you are looking for. 

Right now, you can do gtk_events_pending() and gtk_main_iteration()
to run single iterations of the event loop when necessary.

If what you are looking for is the ability to do your own
select(), I'm currently planning to allow an application
to provide a replacement for poll(); this could, for instance,
allow a program to release a lock around the polll().

[ The other thing that you might be looking for is
  the ability to query the main loop for the filedescriptors
  that need to be selected on, and then later tell GTK+
  to dispatch events. This is less high on the list of 
  features I see as being worthwhile, but it is possible. ]

Regards,
                                        Owen



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