[DB-SIG] [Web-SIG] WSGI thread affinity/interleaving
James Y Knight
foom at fuhm.net
Mon Dec 19 01:34:56 CET 2005
On Dec 18, 2005, at 6:57 PM, M.-A. Lemburg wrote:
> Ian Bicking wrote:
>
>> James Y Knight wrote:
>>
>>> I'm worried about database access. Most DBAPI adapters have
>>> threadsafety level 2: "Threads may share the module and
>>> connections.". So with those, at least, it should be fine to move a
>>> connection between threads, since "share OK" implies "move OK".
>>>
>
> What exactly do you mean with "move" ? Sharing a
> connection refers to multiple threads creating cursors
> on this connection.
I'm asking about moving a cursor, that is, accessing it sequentially
first from one thread, then later from another thread. This is
potentially asking less than sharing, that is, accessing it
simultaneously from two threads.
For example, a simple class without any locking, that only modifies
itself, would generally be movable between threads, but not sharable.
Adding a mutex would make it both.
James
More information about the DB-SIG
mailing list