[Python-Dev] Patch 595601

Greg Ewing greg@cosc.canterbury.ac.nz
Tue, 24 Jun 2003 12:24:20 +1200 (NZST)


Shane Hathaway <shane@zope.com>:

> I think it would be very reasonable to raise an error if a file's
> close() method is called while another thread is executing a system
> call involving that file.

I don't think raising an exception is the right thing to do here. The
closing thread hasn't really done anything wrong, it just happened to
do the close at a moment that was inconvenient to another thread.

I think the closing should simply be deferred until no operation on
the file is in progress.

Another thing -- is this problem confined to just closing? What if two
threads perform some other operation on a file at the same time --
what stops them from interfering with each other? And whatever it is,
why doesn't it stop closing from interfering with other operations?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+