From: <lui...@ne...> - 2004-12-25 12:46:17
|
On Dec 25, 2004, at 5:19 AM, Alexey Nezhdanov wrote: > I do not see the point in interrupting Process(). You can call it w/o > arguments and it will return ASAP w/o any waiting so you will not > waste any > time and will not waste much resources since if there are no pending > events > the work of the Process() will be only calling select() on your tcp > socket. Yes, but if you are calling Process in a cycle and it returns immediately then you'll be calling it constantly. In that case it won't matter how inexpensive Process() is since your task won't block and will thus consume all the available CPU time in its infinite loop. I can't see how it cannot be so: if Process() isn't running then it's not serving xmpp events; if it is running blocked waiting for a xmppy event then it won't service any external events; if it runs but doesn't block it will have to be called uninterruptedly, which works but keeps consuming resources even in the absence of any type of events. > At present I use poll() in my xmppd.py project instead of select() in > xmpppy. > I'm planning to port this functionality into the xmpppy so it will be > possible > to register additional "interrupt" file object. For now you can do: > #============================ > class MyDispatcher(xmpp.dispatcher.Dispatcher): > def Process(timeout=0): > pass > # do something more handy > xmpp.dispatcher.Dispatcher=MyDispatcher > # ... > cl=xmpp.Client('some.jabber.host') > #... > #============================ That's very nice :) I'll see what I can do but I'm not very worried ATM. I'm developing a prototype so even if it keeps running without block its not of much concern for now. |