changing dicts in a threaded environment ?

Bart Thate feedbackflow at gmail.com
Tue Nov 27 13:53:42 CET 2012


Hello All ;]

i wondered if somebody could bring me up to date on the following subject:

i use python3 now and i need to be able to remove elements from a dict in a
thread safe manner.

kinda like a Queue.Queue thing but then in a dict, so i can pass arond  my
dict based objects as parameters arond without having to wonder if it gets
properly locked.

So not only do i need to get this solved:

Issue #14417 <http://bugs.python.org/14417>: Mutating a dict during lookup
now restarts the lookup instead of raising a RuntimeError (undoes issue
#14205 <http://bugs.python.org/14205>).

i also need to lock all the actual modifying underlying "real" stuff as
well not just the iterator or view or whatever i don't know yet ;]

So my question is kinda like, is a dict possible in the same way the
Queue.Queue is now made truely thread safe ?

Also is there something like a select.select for queues ?

I want to pass a dict to a thead and then have a watcher on the dicts state
if result have arrived.

For what i am making dicts are the basis of everything, json dumpable so
the state op the object can be saved or send over the wire as well.

Thnx for your time and energy ;]

Grtx,

Bart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121127/66c6518b/attachment.html>


More information about the Python-list mailing list