On Mon, 2002-08-19 at 17:59, Tavis Rudd wrote:
> from threading import Lock
> class Counter:
> _count = 1
> __sharedState = {'_lock': Lock()}
> def __init__(self):
> self.__dict__ = self.__sharedState
>
> def count(self):
> return self._count
>
> def increment(self):
> self._lock.acquire()
> self._lock += 1
> self._lock.release()
>
> def decrement(self):
> self._lock.acquire()
> self._lock -= 1
> self._lock.release()
Lest it cause confusion, you mean "count += 1", of course.
Ian
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss