[ZODB-Dev] Thread safety
Tim Peters
tim at zope.com
Mon Oct 4 11:15:12 EDT 2004
[Dmitry Vasiliev]
> For example consider the following code:
>
> def getReply(request):
> lock.acquire()
> try:
> try:
> reply = _getReply(request)
> transaction.commit()
> except:
> log.error("error", exc_info=True)
> transaction.abort()
> reply = None
> return reply
> finally:
> lock.release()
>
> All persistent objects changes only inside _getReply() function. Two
> threads concurrently calls getReply() function...
>
> Is it safe? Is it possibly/safe to use only one connection object?
*Offhand* I can't think of a reason for that breaking. But it's not how
threads were intended to be used in ZODB, and I don't have spare time to
think about it. Maybe someone else does.
More information about the ZODB-Dev
mailing list