I guess this might be overkill then...

class MyList(list):
    def __init__(self):
        self.l = threading.Lock()

    def append(self, val):
        try:
            self.l.acquire()
            list.append(self, val)
        finally:
            if self.l.locked():
                self.l.release()

....performing the same locking/unlocking for the other methods (i.e.
remove, extend, etc).

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to