Queue peek?

mk mrkafk at gmail.com
Tue Mar 2 22:54:39 CET 2010

Daniel Stutzbach wrote:
> On Tue, Mar 2, 2010 at 1:58 PM, Martin P. Hellwig 
> <martin.hellwig at dcuktec.org <mailto:martin.hellwig at dcuktec.org>> wrote:
>     What actually happens if multiple threads at the same time, write to
>     a shared dictionary (Not using the same key)?

> All of Python's built-in types are thread safe.  Both updates will happen.

No need to use synchro primitives like locks?

I know that it may work, but that strikes me as somehow wrong... I'm 
used to using things like Lock().acquire() and Lock().release() when 
accessing shared data structures, whatever they are.

Although trying to do the "right thing" may indeed get one in trouble in 
case of deadlock caused by a bug in one's own program.


More information about the Python-list mailing list