Make parallelism options more well defined.

This commit is contained in:
Mike Auty
2019-03-02 18:52:02 +00:00
parent 9fadee1a17
commit 33a9db6b9f
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -56,5 +56,8 @@ MAC_BANNERS_PATH = os.path.join(CACHE_PATH, "mac_banners.cache")
ProgressCallback = Optional[Callable[[float, str], None]]
# Options are 'multiprocessing', 'threading' or None
PARALLELISM = 'multiprocessing'
PARALLELISM_OFF = 0
PARALLELISM_THREADING = 1
PARALLELISM_MULTIPROCESSING = 2
PARALLELISM = PARALLELISM_MULTIPROCESSING
+1 -1
View File
@@ -104,7 +104,7 @@ class FileLayer(interfaces.layers.DataLayerInterface):
self._file_ = None # type: Optional[IO[Any]]
self._size = None # type: Optional[int]
# Construct the lock now (shared if made before threading) in case we ever need it
if constants.PARALLELISM == 'threading':
if constants.PARALLELISM == constants.PARALLELISM_THREADING:
self._lock = threading.Lock()
else:
# We don't need a lock for multiprocessing because child threads can't inherit file descriptors by default