[Twisted-Python] threading on windows?

Sean Riley sean at twistedmatrix.com
Tue Aug 21 18:40:26 EDT 2001

actually i have a counter question that is "how the hell does this work on
Linux at all?"

during startup, threadable.init() is called twice - once by internet.main
calling requireInit() which passes zero and once by twistd which passes zero
or one if "-t" was specified.

the first time through, the global threaded is set to zero.
the second time through, the "assert threaded is None" in threadable.init()
should always fail as threaded is not None, it is now zero. This assert
failing causes threadable.threaded to get left as zero and the
initialization of installing the waker and scheduler never gets done.

-----Original Message-----
From: twisted-python-admin at twistedmatrix.com
[mailto:twisted-python-admin at twistedmatrix.com]On Behalf Of Itamar
Sent: Tuesday, August 21, 2001 5:14 PM
To: twisted-python at twistedmatrix.com
Subject: Re: [Twisted-Python] threading on windows?

Sean Riley wrote:

> threaded initialization stuff twisted.internet.main.py is not working for
> on windows.
> I propose we put all threaded initialization into a method of
> twisted.internet.main and have it called from threadable.init() in one
> place.

Yes, but threaded can be used without internet.main's event loop, so it
shouldn't depend on it.

> This would include:
> 	installWaker()
> 	delayeds.append(threadtask.theScheduler)
> how about internet.main.enableThreading() which would do the work that is
> currently in installWaker and set up the delayed scheduler?

note that threading has to be initialized before threadtask is imported,
so that it will be synchronized.

Can you explain why the current code doesn't work in Windows?

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list