[pygtk] Does gobject.idle_add guarantee execution order?

Christopher Backhouse cjbackhouse at gmail.com
Mon Dec 10 01:49:34 WST 2007


OK, so there seems to be agreement that it isn't guaranteed.

> def dispatcher(callables, args):
>     if len(callables):
>         return callables.pop(0)(args)
>     else:
>          return False

I went for something a bit like this. Code in case anyone cares:

class _DeferClass:
	_calls=[]
	def __call__(self,func,*args):
	   	def NextCall():
			(func,args)=self._calls[0]
			func(*args)
			self._calls=self._calls[1:]
			return self._calls!=[]
			
		if not self._calls: gobject.idle_add(NextCall)
		self._calls.append((func,args))
		
Defer=_DeferClass()


Thanks for the replies.


More information about the pygtk mailing list