[Twisted-Python] One big smile ...
radix at twistedmatrix.com
Fri Jul 11 20:29:31 EDT 2003
On Sat, Jul 12, 2003 at 02:05:16AM +0200, Thomas Weholt wrote:
> I implemented a small newsfetching webserver today. At first I used some
> blocking code at startup and then reactor.callLater(some_intervall,
> sameBlockingMethod) to call it later and refresh the content later. It
> processed about 8-10 RSS/RDF feeds and then handed my server back to me so I
> could see the output. I was quite happy about the result. Just for fun I
> tried to do the blocking code in a thread instead, - with mixed results.
> Read some more docs. And did a deferToThread for each call to the blocking
> method. Added a callback-method that parsed the results. A bit more hacking
> and ...then .. suddenly ... it was just .... so fast. No hogging the server
> at startup, all content fetched,, *much* faster than before. Everything
> seemed great. I had finally got the grip on threads and deferred. But
> something was wrong with my data. Some data were in the wrong lists etc. so
> I guess I need some mutex-locking or something. This is were you guys come
> in. Do I need to aquire a lock to avoid updating wrong parts of my
Why are you even using threads? What API are you using that is only
available as blocking calls?
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
More information about the Twisted-Python