Skip to content

Commit

Permalink
Merge branch 'develop-neoloki'
Browse files Browse the repository at this point in the history
  • Loading branch information
josephnobes-stfc committed Aug 15, 2024
2 parents 535b8ef + 14c0e36 commit 1663b97
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions control/loki/register_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,22 @@ def acquire(self, blocking=True, timeout=-1):
# Grab the lock with the supplied settings
result = self._register_mutex.acquire(blocking=blocking, timeout=timeout)

# Allow the caller to execute their 'with'. 'result' is needed so that
# if the lock cannot be grabbed the user can handle it.
yield result

# Release the lock, if it was actually acquired
if result:
self._register_mutex.release()
try:
# Allow the caller to execute their 'with'. 'result' is needed so that
# if the lock cannot be grabbed the user can handle it.
yield result

except:
# Pass through any exception
raise

finally:
# Even if there is an exception, release the lock so that it doesn't lock up the ASIC
# access. This will only release the lock if it was actually gained in the first place.

# Release the lock, if it was actually acquired
if result:
self._register_mutex.release()

def get_word_width(self):
return self._word_width_bits
Expand Down

0 comments on commit 1663b97

Please sign in to comment.