[Python-Dev] Segfault

Hrvoje Nikšić hrvoje.niksic at avl.com
Wed Aug 22 10:42:47 CEST 2007


On Wed, 2007-08-22 at 10:35 +0200, Hrvoje Nikšić wrote:
> I think we need a reliable mechanism to prevent file_close messing with
> f_fp while other operations are being performed.  Since each FILE has an
> internal lock associated with it, flockfile could be used to lock out
> the sections that access f_fp (falling back to a mutex in PyFileObject
> on platforms without flockfile) without affecting other threads that
> operate on other FILE's.

Scrap this suggestion, it won't work as written.  flockfile must not be
called after the FILE is deallocated, which is exactly what fclose does.
The mutex would need to be in PyFileObject itself.




More information about the Python-Dev mailing list