[Python-Dev] threadsafe patch for asynchat

Steve Holden steve at holdenweb.com
Wed Feb 8 13:25:35 CET 2006


Josiah Carlson wrote:
> "Fredrik Lundh" <fredrik at pythonware.com> wrote:
> 
>>Steve Holden wrote:
>>
>>
>>>>What is the reason that people want to use threads when they can have
>>>>poll/select-style message processing? Why does Zope require threads?
>>>>IOW, why would anybody *want* a "threadsafe patch for asynchat"?
>>>>
>>>
>>>In case the processing of events needed to block? If I'm processing web
>>>requests in an async* dispatch loop and a request needs the results of a
>>>(probably lengthy) database query in order to generate its output, how
>>>do I give the dispatcher control again to process the next asynchronous
>>>network event?
>>>
>>>The usual answer is "process the request in a thread". That way the
>>>dispatcher can spring to life for each event as quickly as needed.
>>
>>but why do such threads have to talk to asyncore directly ?
> 
Good question.
> 
> Indeed.  I seem to remember a discussion a few months ago about "easy"
> thread programming, which invariably directed people off to use the
> simplest abstractions necessary: Queues.
> 
Maybe people are finding Python too easy and they just want to 
complicate their code to the point where it contains interesting bugs? I 
dunno ....

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/



More information about the Python-Dev mailing list