[Python-Dev] Proposed PEP: Optimizing Global Variable and Attribute Access

Aahz Maruch aahz at panix.com
Thu Aug 16 20:39:58 EDT 2001


In article <mailman.997792702.17326.python-list at python.org>,
Skip Montanaro  <skip at pobox.com> wrote:
>
>    Roman> What about threads? What if math.sin changes while in cache?
>
>I added the following to a new Questions section:
>
>Q.  What about threads?  What if math.sin changes while in cache?
>
>A.  I believe the global interpreter lock will protect values from being
>    corrupted.  In any case, the situation would be no worse than it is
>    today.  If one thread modified math.sin after another thread had
>    already executed "LOAD_GLOBAL math", but before it executed
>    "LOAD_ATTR sin", the client thread would see the old value of
>    math.sin. 

Yup, more or less.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"I used to have a .sig but I found it impossible to please everyone..."  --SFJ



More information about the Python-list mailing list