use GLib.io_add_watch_full when available

This commit is contained in:
Daniel Pavel 2013-06-08 15:02:44 +02:00
parent 46544e1cbe
commit f324b97e8b
1 changed files with 5 additions and 1 deletions

View File

@ -150,7 +150,11 @@ def monitor_glib(callback, *device_filters):
GLib.idle_add(cb, 'remove', d_info)
break
return True
GLib.io_add_watch(m, GLib.PRIORITY_DEFAULT, GLib.IO_IN, _process_udev_event, callback, device_filters)
try:
# io_add_watch_full appeared in a later version of glib
GLib.io_add_watch_full(m, GLib.PRIORITY_LOW, GLib.IO_IN, _process_udev_event, callback, device_filters)
except:
GLib.io_add_watch(m, GLib.IO_IN, _process_udev_event, callback, device_filters)
m.start()