multiprocessing.sharedctypes and built-in locks

Ahmad Syukri b syockit at gmail.com
Mon Mar 16 05:42:00 CET 2009


On Mar 15, 6:19 am, Aaron Brady <castiro... at gmail.com> wrote:
>
> Your code hung on my machine.  The call to 'main()' should be in an
> 'if __name__' block:
>
> if __name__== '__main__':
>     main()
>
> Is it possible you are just seeing the effects of the non-atomic
> '__iadd__' operation?  That is, the value is read, added, and written
> at different times, between which other processes might have
> intervened.

I've forgotten to remove ' gl.append(mp.Lock()) ' from the second
code.

Anyways if what you said is true, then why doesn't the documentation
say so? I also realized that the created lock's release and acquire
methods are also imbued to the created shared object, and this is also
undocumented.



More information about the Python-list mailing list