On 12/17/2011 01:30 AM, Brad Tilley wrote:
Or perhaps run should look like this instead:

     def run(t):
         lock.acquire()
         shared_container.append(t.name <http://t.name>)
         lock.release()

That seems a bit barbaric to me, not sure.

change that to:

def run(t):
    with lock:
        shared_container.append(t.name <http://t.name>)


the `with-statement` will call lock.acquire() and lock.release().

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

Reply via email to