Skip to content

Commit

Permalink
Fixed issue with bus operations deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
kingofpayne committed Feb 6, 2024
1 parent 841eef2 commit 7733ffe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions api/scaffold/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,10 @@ def delay(self, duration: float):
cycles = round(duration * self.sys_freq)
self.bus.delay(cycles)

def wait(self):
"""Wait for all pending operations to be completed."""
self.bus.wait()


class Scaffold(ArchBase):
"""
Expand Down
7 changes: 2 additions & 5 deletions api/scaffold/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def __init__(self):
self.bus = None
self.status = OperationStatus.PENDING

def __del__(self):
assert self.status in (OperationStatus.COMPLETED, OperationStatus.TIMEOUT)

def wait(self):
"""Wait until this operation has been processed."""
if self.status == OperationStatus.PENDING:
Expand Down Expand Up @@ -354,10 +351,10 @@ def __init__(self, sys_freq, baudrate):
self.__fifo_size = 0
self.version = None

def __del__(self):
def wait(self):
"""Wait for all pending operations to be completed."""
while len(self.__operations) > 0:
self.resolve_next_operation()
del self.__operations

def connect(self, dev):
"""
Expand Down

0 comments on commit 7733ffe

Please sign in to comment.