[Python-Dev] Pythonic concurrency

skip@pobox.com skip at pobox.com
Mon Oct 10 20:20:31 CEST 2005


    >> The hard part is knowing when and how to lock shared resources...

    Bill> Well, I might say the "careful part".

With the Mojam middleware stuff I suffered quite awhile with a
single-threaded implementation that would hang the entire webserver if a
backend query took too long.  I realized I needed to do something (threads,
asyncore, whatever), but didn't think I understood the issues well enough to
do it right.  Once I finally bit the bullet and switched to a multithreaded
implementation, I didn't have too much trouble.  Of course, the application
was pretty mature at that point and I understood what objects were shared
and needed to be locked.  Oh, and I took Aahz's admonition to heart and
pretty much stuck to using Queues for all synchronization.  It ain't rocket
science, but it can be subtle.

Skip


More information about the Python-Dev mailing list