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