[Twisted-Python] Second try at reporting gtk reactor problem
David E. Konerding
dekonerding at lbl.gov
Fri Feb 27 09:17:31 MST 2004
Hello, since nobody actually responding with a useful message regarding
my report, I'm
reposting an extremely simple (1 page) example which exhibits the behavior.
My example creates a gtkreactor and runs it. A small reporter class is
run from a second thread.
Under the gtk reactor, the log messages from the second thread are not
reported in a timely
fashion (only once per second or so). From my understanding the
messages should be printed more frequently (about once every 1/10th
second). This does work under the wx and plain reactors, so I suspect
there is a defect in the gtk reactor.
I would simply like to get a confirmation that my example is a valid
one, that the results I expect are valid, and that other
people can reproduce my experience. If that is the case then I will
submit a formal bug report. All of this should be reproducible using
Twisted 1.2.0. Things get even weirder if you remove the logging
support and replace it with all print statements.
import time, sys
from twisted.internet import gtk2reactor
gtk2reactor.install()
from twisted.python import threadable
threadable.init()
from twisted.internet import reactor
from twisted.python import log
log.startLogging(sys.stdout)
class TestThingy:
def __init__(self):
print "TestThingy created"
def run(self):
print "TestThingy run"
for i in range(10):
print "TestThingy message"
time.sleep(0.1)
print "TestThingy done"
class ThingyManager:
def __init__(self):
pass
def submitThingy(self):
log.err("ThingyManager submitting")
f = TestThingy()
log.err("ThingyManager created")
reactor.callInThread(f.run)
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)
reactor.run()
log.err("Reactor done")
More information about the Twisted-Python
mailing list