assert pid
GObject.child_watch_add(pid, callback)
return pid
+
+class ScheduledFunction(object):
+ def __init__(self, interval, function):
+ """
+ @type interval: float
+ @param interval: seconds
+ """
+ self.event = GObject.timeout_add(int(1000 * interval), function)
+
+ def cancel(self):
+ ret = GObject.source_remove(self.event)
+ assert ret