[Twisted-Python] threading on windows?

Sean Riley sean at twistedmatrix.com
Tue Aug 21 16:23:28 EDT 2001

I am trying to get a threaded twisted server to run on windows (Windows2000
SP3) and having some issues.

There is an assert in threadable.py in init():

def init(with_threads):
    global threaded, _to_be_synched, dispatcher, dispatch, Waiter,
    print "Threadable init", with_threads
    if threaded == with_threads:
    assert threaded is None
    threaded = with_threads

that always asserts whether I pass "-t" to twistd or not.  It seems that
requireInit() gets called before init() so the code:

def requireInit():
    global threaded
    if threaded is None:

is always run to initialize the global "threaded" to zero.

If i take out that "assert threaded in None" it seems to initialize
correctly on the "second" time through.

But, in internet.main the global "waker" is never initialized as
installWaker() is never called. I think that is because threadable.threaded
was initialized as 0 the "first" time through when it was called by
requireInit() and the code:

if threadable.threaded:

in internet.main.py skips the installWaker() call.

Anyone else tried running a threaded server on windows?

More information about the Twisted-Python mailing list