En Mon, 05 May 2008 08:26:45 -0300, Vaibhav.bhawsar <[EMAIL PROTECTED]> escribió:

Hello
I have a thread updating a dictionary with new elements. How can I check for
new elements as they are inserted into the dictionary by the thread? In
general is it safe to read a dictionary or a list while it is being updated
by a running thread? Does the dictionary or list have to be locked while
reading?
many questions! :)

Use a Queue object to communicate between threads. The language itself doesn't guarantee anything about atomicity. You might put the new elements in a queue, and make the consumer update the dictionary instead of the producer.


--
Gabriel Genellina

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

Reply via email to