When to lock data items returned by multiprocessing.Manager?

Aahz aahz at pythoncraft.com
Mon Mar 15 20:57:23 CET 2010


In article <4428d674-7fa7-4095-a93d-75ea31a81d9a at 15g2000yqi.googlegroups.com>,
Veloz  <michaelveloz at gmail.com> wrote:
>
>So I'm using a multiprocessing.Manager instance in my main app and
>asking it to create a dictionary, which I am providing to instances of
>the application that I'm forking off with Process.
>
>The Processes and main app will be reading/writing to the dictionary.
>
>It's not clear to me what I have to "lock" and what I don't have to
>lock. Any ideas?

The way I deal with it is by making sure each key is only updated by a
single process.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer



More information about the Python-list mailing list