MySQLdb multithreaded
Greg Fortune
lists at gregfortune.com
Wed May 7 17:24:30 EDT 2003
Disclaimer - I wrote my own connection pool and haven't ever used Andy's so
what I'm about to state is what I gleaned from reading through the source.
Hopefully my explanation is correct ;o)
It just adds a thin layer that instantiates new connections as necessary.
You'd start the queue off empty and then it would allocate a new connection
when the first thread requested a connection. If the second thread requested
before the first thread was done, another new connection would be allocated,
otherwise the first connection is returned. It's available here if you're
curious.. http://dustman.net/andy/python/Pool
Greg
On Wednesday 07 May 2003 01:37 pm, Skip Montanaro wrote:
> Greg> Right, but unless you implement locking in your app, the threads
> Greg> can't share the connection because you don't know when each
> thread Greg> might be accessing the connection. So, unless you are already
> Greg> explicitly doing locking, the definition is exactly right. For Greg>
> anyone else still reading, you might check out Andy Dustman's Pool Greg>
> module that will allow the type of behavior Skip describes.
>
> Yes, I use the Queue module. Take out a connection to use it and put it
> back when through. What advantages does Andy's Pool module provide?
>
> Skip
More information about the Python-list
mailing list