[Twisted-Python] twisted gtk-reactor bug 552

David E. Konerding DSD Staff dekonerding at lbl.gov
Mon Apr 26 17:47:10 EDT 2004


I'm checking in again to see if anybody had taken a look at my bug report,


I discussed it a little bit on a slow day on IRC, but nobody had any 
However, it was reproduced on NetBSD-current w/ pygtk-2 and gtk-2.4, so I'm
pretty sure it's not specific to my location.

In summary:

I'm using the gtk2reactor, and periodically scheduled events (invoked 
via reactor.callLater->reactor.callInThread)
are not being fired in a timely fashion.  When I originally mentioned 
the bug on the mailing list, people thought
I was calling 'sleep' in the main (reactor) thread, but actually, sleep 
is only called in another thread, and
it works fine with the plain reactor and the wx reactor.

Here is the example program (you should see 'TestThingy message' every 
0.1 seconds or so..)
Note that the bug report has two lines improperly indented.

import time, sys

from twisted.internet import gtk2reactor
from twisted.python import threadable
from twisted.internet import reactor
from twisted.python import log

class TestThingy:
 def __init__(self):
     print "TestThingy created"

 def run(self):
     print "TestThingy run"
     for i in range(10):
         print "TestThingy message"
     print "TestThingy done"

class ThingyManager:
 def __init__(self):

 def submitThingy(self):
     log.err("ThingyManager submitting")
     f = TestThingy()
     log.err("ThingyManager created")
     log.err("ThingyManager calledInThread")

def ticker(*args):
 log.err("ticker: %d" % time.time())
 reactor.callLater(1, ticker)

t = ThingyManager()
reactor.callLater(0, ticker)
reactor.callLater(3, t.submitThingy)
log.err("Reactor done")


More information about the Twisted-Python mailing list