Show More
@@ -307,7 +307,10 b' class abstractvfs(object):' | |||||
307 | # Sharing backgroundfilecloser between threads is complex and using |
|
307 | # Sharing backgroundfilecloser between threads is complex and using | |
308 | # multiple instances puts us at risk of running out of file descriptors |
|
308 | # multiple instances puts us at risk of running out of file descriptors | |
309 | # only allow to use backgroundfilecloser when in main thread. |
|
309 | # only allow to use backgroundfilecloser when in main thread. | |
310 | if not isinstance(threading.currentThread(), threading._MainThread): |
|
310 | if not isinstance( | |
|
311 | threading.currentThread(), | |||
|
312 | threading._MainThread, # pytype: disable=module-attr | |||
|
313 | ): | |||
311 | yield |
|
314 | yield | |
312 | return |
|
315 | return | |
313 | vfs = getattr(self, 'vfs', self) |
|
316 | vfs = getattr(self, 'vfs', self) | |
@@ -318,10 +321,14 b' class abstractvfs(object):' | |||||
318 |
|
321 | |||
319 | with backgroundfilecloser(ui, expectedcount=expectedcount) as bfc: |
|
322 | with backgroundfilecloser(ui, expectedcount=expectedcount) as bfc: | |
320 | try: |
|
323 | try: | |
321 |
vfs._backgroundfilecloser = |
|
324 | vfs._backgroundfilecloser = ( | |
|
325 | bfc # pytype: disable=attribute-error | |||
|
326 | ) | |||
322 | yield bfc |
|
327 | yield bfc | |
323 | finally: |
|
328 | finally: | |
324 |
vfs._backgroundfilecloser = |
|
329 | vfs._backgroundfilecloser = ( | |
|
330 | None # pytype: disable=attribute-error | |||
|
331 | ) | |||
325 |
|
332 | |||
326 |
|
333 | |||
327 | class vfs(abstractvfs): |
|
334 | class vfs(abstractvfs): | |
@@ -477,7 +484,8 b' class vfs(abstractvfs):' | |||||
477 | fp = checkambigatclosing(fp) |
|
484 | fp = checkambigatclosing(fp) | |
478 |
|
485 | |||
479 | if backgroundclose and isinstance( |
|
486 | if backgroundclose and isinstance( | |
480 |
threading.currentThread(), |
|
487 | threading.currentThread(), | |
|
488 | threading._MainThread, # pytype: disable=module-attr | |||
481 | ): |
|
489 | ): | |
482 | if not self._backgroundfilecloser: |
|
490 | if not self._backgroundfilecloser: | |
483 | raise error.Abort( |
|
491 | raise error.Abort( |
General Comments 0
You need to be logged in to leave comments.
Login now