##// END OF EJS Templates
vfs: modernize the detection of the main thread...
Matt Harbison -
r52776:1edac12a default
parent child Browse files
Show More
@@ -373,10 +373,7 class abstractvfs:
373 # Sharing backgroundfilecloser between threads is complex and using
373 # Sharing backgroundfilecloser between threads is complex and using
374 # multiple instances puts us at risk of running out of file descriptors
374 # multiple instances puts us at risk of running out of file descriptors
375 # only allow to use backgroundfilecloser when in main thread.
375 # only allow to use backgroundfilecloser when in main thread.
376 if not isinstance(
376 if threading.current_thread() is not threading.main_thread():
377 threading.current_thread(),
378 threading._MainThread, # pytype: disable=module-attr
379 ):
380 yield
377 yield
381 return
378 return
382 vfs = getattr(self, 'vfs', self)
379 vfs = getattr(self, 'vfs', self)
@@ -575,9 +572,9 class vfs(abstractvfs):
575 )
572 )
576 fp = checkambigatclosing(fp)
573 fp = checkambigatclosing(fp)
577
574
578 if backgroundclose and isinstance(
575 if (
579 threading.current_thread(),
576 backgroundclose
580 threading._MainThread, # pytype: disable=module-attr
577 and threading.current_thread() is threading.main_thread()
581 ):
578 ):
582 if (
579 if (
583 not self._backgroundfilecloser # pytype: disable=attribute-error
580 not self._backgroundfilecloser # pytype: disable=attribute-error
General Comments 0
You need to be logged in to leave comments. Login now