GNOME Bugzilla – Bug 620901
IO events make GUI unresponsive
Last modified: 2012-04-20 11:49:26 UTC
Consider the attached example. It reads and writes using non-blocking I/O and gobject.io_add_watch. It also tries to display a label. However, the label never actually manages to be rendered because the I/O is always given priority.
On the #pygtk IRC channel on gimpnet, I learned that there's an undocumented `priority` keyword argument accepted by `gobject.io_add_watch`. By experimenting with different values for this keyword, I was able to make the GUI in the example responsive. It would be great to document this parameter. I also wonder if it's worth considering the decision to make I/O events higher priority than GUI redraws (expose events?).
glib.io_add_watch mentions the priority keyword in docs.
It would be quite nice if it were mentioned here: $ pydoc glib.io_add_watch Help on built-in function io_add_watch in glib: glib.io_add_watch = io_add_watch(...) io_add_watch(fd, condition, callback, user_data=None) -> source id callable receives (fd, condition, user_data) Arranges for the fd to be monitored by the main loop for the specified condition. Condition is a combination of glib.IO_IN, glib.IO_OUT, glib.IO_PRI, gio.IO_ERR and gio.IO_HUB. Or if these docs were removed and replaced with a reference to the documentation on the website. The existence of the above API documentation strongly implies there is no `priority` keyword (cutting short a search for any further information on the topic). Additionally, the priority documentation at http://library.gnome.org/devel/pygobject/stable/glib-functions.html#function-glib--io-add-watch strikes me as rather suboptimal. `priority` is not included in the function signature and there's no suggestion of what acceptable values might be.
Moving to pygobject as it will see a reorganization this cycle.
Thanks for taking the time to report this bug. However, this bug report applies to a PyGObject version that is too old and not supported anymore. PyGObject developers are no longer working on static bindings, so unfortunately there will not be any bug fixes for the version this report applies to. By upgrading to a newer version of PyGObject you could receive bug fixes and new functionality. Please feel free to reopen this bug if the problem still occurs with a newer version of PyGObject.