From 3a976cd9ee0e98690ef0749c2864bf5f3e12c764 Mon Sep 17 00:00:00 2001 From: Lars Asplund Date: Sun, 15 Sep 2024 11:46:54 +0200 Subject: [PATCH] Fixed race condition. --- vunit/sim_if/modelsim.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vunit/sim_if/modelsim.py b/vunit/sim_if/modelsim.py index 660fbdc30..f58c3f540 100644 --- a/vunit/sim_if/modelsim.py +++ b/vunit/sim_if/modelsim.py @@ -387,9 +387,6 @@ def _optimize(self, config, script_path): # non-alphanumeric characters is a simple solution to that simulation_target = "opt_" + "".join(ch for ch in design_to_optimize if ch.isalnum()) - with self._vopt_lock: - self._optimized_designs[design_to_optimize]["simulation_target"] = simulation_target - optimize_file_name = script_path / "optimize.do" write_file( str(optimize_file_name), self._create_optimize_script(design_to_optimize, simulation_target, config) @@ -417,6 +414,9 @@ def _optimize(self, config, script_path): LOGGER.debug("Failed to optimize %s.", design_to_optimize) return False + with self._vopt_lock: + self._optimized_designs[design_to_optimize]["simulation_target"] = simulation_target + LOGGER.debug("%s optimization completed.", design_to_optimize) self._optimized_designs[design_to_optimize]["vopt_event"].set()