diff options
-rw-r--r-- | mpm/python/usrp_mpm/uio.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mpm/python/usrp_mpm/uio.py b/mpm/python/usrp_mpm/uio.py index 2ea76233f..40991f1eb 100644 --- a/mpm/python/usrp_mpm/uio.py +++ b/mpm/python/usrp_mpm/uio.py @@ -136,6 +136,17 @@ class UIO(object): offset=offset, ) + def __del__(self): + """ + Destructor needs to close the uio-mapped memory + """ + try: + self._mm.close() + os.close(self._fd) + except: + self.log.warning("Failed to properly destruct UIO object.") + pass + def peek32(self, addr): """ Returns the 32-bit value starting at address addr as an integer |