mercurial/vfs.py
changeset 47178 63286e0886a6
parent 46819 d4ba4d51f85f
child 47443 9ab54aa56982
equal deleted inserted replaced
47177:5d5abfdc32d8 47178:63286e0886a6
   305         """
   305         """
   306         # Sharing backgroundfilecloser between threads is complex and using
   306         # Sharing backgroundfilecloser between threads is complex and using
   307         # multiple instances puts us at risk of running out of file descriptors
   307         # multiple instances puts us at risk of running out of file descriptors
   308         # only allow to use backgroundfilecloser when in main thread.
   308         # only allow to use backgroundfilecloser when in main thread.
   309         if not isinstance(
   309         if not isinstance(
   310             threading.currentThread(),
   310             threading.current_thread(),
   311             threading._MainThread,  # pytype: disable=module-attr
   311             threading._MainThread,  # pytype: disable=module-attr
   312         ):
   312         ):
   313             yield
   313             yield
   314             return
   314             return
   315         vfs = getattr(self, 'vfs', self)
   315         vfs = getattr(self, 'vfs', self)
   481                     % mode
   481                     % mode
   482                 )
   482                 )
   483             fp = checkambigatclosing(fp)
   483             fp = checkambigatclosing(fp)
   484 
   484 
   485         if backgroundclose and isinstance(
   485         if backgroundclose and isinstance(
   486             threading.currentThread(),
   486             threading.current_thread(),
   487             threading._MainThread,  # pytype: disable=module-attr
   487             threading._MainThread,  # pytype: disable=module-attr
   488         ):
   488         ):
   489             if (
   489             if (
   490                 not self._backgroundfilecloser  # pytype: disable=attribute-error
   490                 not self._backgroundfilecloser  # pytype: disable=attribute-error
   491             ):
   491             ):