Skip to content

Commit

Permalink
Removed check of _lock files
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsAsplund committed Sep 16, 2024
1 parent 28743da commit 7032b5e
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions vunit/sim_if/modelsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,7 @@ def _run_optimize_batch_file(self, batch_file_name, script_path):

return status

@staticmethod
def _wait_for_file_lock(library):
"""
Wait for any _lock file to be removed.
"""
log_waiting = True
while (Path(library.directory) / "_lock").exists():
if log_waiting:
LOGGER.debug("Waiting for %s to be removed", Path(library.directory) / "_lock")
log_waiting = False
sleep(0.05)

def _acquire_library_lock(self, library, config, design_to_optimize):
def _acquire_library_lock(self, config, design_to_optimize):
"""
Acquire library lock and wait for any lock file to be removed.
"""
Expand All @@ -343,15 +331,13 @@ def _acquire_library_lock(self, library, config, design_to_optimize):
while not library_lock.acquire(timeout=0.05):
pass

self._wait_for_file_lock(library)
LOGGER.debug("Acquired library lock for %s to optimize %s", config.library_name, design_to_optimize)

def _release_library_lock(self, library, config):
def _release_library_lock(self, config):
"""
Release library lock and wait for any lock file to be removed.
"""
with self._shared_state_lock:
self._wait_for_file_lock(library)
self._library_locks[config.library_name].release()

def _optimize(self, config, script_path):
Expand Down Expand Up @@ -388,7 +374,7 @@ def _optimize(self, config, script_path):
optimized_design, optimization_completed = self._optimized_designs[design_to_optimize].values()

if optimize:
self._acquire_library_lock(library, config, design_to_optimize)
self._acquire_library_lock(config, design_to_optimize)

LOGGER.debug("Optimizing %s", design_to_optimize)

Expand Down Expand Up @@ -417,7 +403,7 @@ def _optimize(self, config, script_path):

status = self._run_optimize_batch_file(batch_file_name, script_path)

self._release_library_lock(library, config)
self._release_library_lock(config)

if not status:
LOGGER.debug("Failed to optimize %s.", design_to_optimize)
Expand Down

0 comments on commit 7032b5e

Please sign in to comment.