From 33a9db6b9f838fbcdedd0aba9b3e9d24a8512407 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 2 Mar 2019 18:52:02 +0000 Subject: [PATCH] Make parallelism options more well defined. --- volatility/framework/constants/__init__.py | 7 +++++-- volatility/framework/layers/physical.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/volatility/framework/constants/__init__.py b/volatility/framework/constants/__init__.py index d08dfd8f2..9e0365deb 100644 --- a/volatility/framework/constants/__init__.py +++ b/volatility/framework/constants/__init__.py @@ -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 diff --git a/volatility/framework/layers/physical.py b/volatility/framework/layers/physical.py index 9b0ad6562..7e8f9de86 100644 --- a/volatility/framework/layers/physical.py +++ b/volatility/framework/layers/physical.py @@ -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