Hi,
I have a method which increments an attribute on the current object. I
have created a thread lock so that multiple threads accessing the method
simultaneously cannot stuff up the attribute value:
lock = thread.allocate_lock()
def nextOrderNumber(self):
lock.acquire()
self._order_number = self._order_number + 1
lock.release()
return str(self._order_number)
My concern is that even though a second thread is halted at
"lock.acqure()" while the first thread updates the order_number, that
the second thread has an 'out of date' version of 'self' with the
original order_number value in it, hence, is still returning the
incorrect order_number.
Do I need to explicity get the order_number attribute from the ZODB
somehow, rather than grabbing it from 'self'?
terry
--
Terry Kerr ([EMAIL PROTECTED])
Bizar Software Pty Ltd (www.bizarsoftware.com.au)
Phone: +61 3 9563 4461
Fax: +61 3 9563 3856
ICQ: 79303381
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )