Hello,
Please advise on multi-threaded list *append*:
import time, random, thread
aList = []
def main():
for i in range(10):
thread.start_new_thread(updater, (i,))
time.sleep(30)
print aListdef updater(n): global aList time.sleep( random.randint(1,n+1) ) aList.append(n)
if __name__=='__main__': main()
I rely on GIL and believe that .append is atomic operation. It that legal? What are the drawbacks?
Thanks, Mike
-- http://mail.python.org/mailman/listinfo/python-list
