[issue815646] thread unsafe file objects cause crash

Gregory P. Smith report at bugs.python.org
Sun Apr 6 05:07:16 CEST 2008


Gregory P. Smith <greg at krypto.org> added the comment:

I'm reviewing this patch now and plan to commit it after some testing.

A couple comments:

I'd rename your sts variables to status.

Also FYI:

Your use of volatile on the int unlocked_count member of PyFileObject
does not do what you think it does and isn't needed here anyways.

Access to the variable is always protected by the GIL unlocking and
locking of which should cause an implicit memory barrier guaranteeing
that all other CPUs in the system will see the same value stored in the
structure in memory.

The C volatile keyword on the other hand does not guarantee this. 
volatile is useful for memory mapped IO but it makes no guarantees about
cache coherent access between multiple CPUs.  (the atomic types in the
recent C++ standards are meant for that)


Both of the above are trivial changes, no need for another patch.

----------
assignee: tim_one -> gregory.p.smith
nosy: +gregory.p.smith
versions: +Python 3.0

____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue815646>
____________________________________


More information about the Python-bugs-list mailing list