"Morten W. Petersen" wrote:
> There's a new product available, which enables unique ids in a given context,
> take a look at <url:http://www.zope.org/Members/morphex/ThreadSafeCounter>.

So would a counter such as:

class PersistentCounter(Persistent):

    # create the counter
    def __init__(self, value=0):
        self._value = value

    # get the value of the counter without incrementing
    def getValue(self):
        return self._value

    # increment the counter when called, and return the new value
    def __call__(self, number=1):
        self._value = self._value + number
        return self._value

...not be thread safe?

If not, can anyone explain how it could be made thread safe?



Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to