diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2017-11-27 18:19:45 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:57 -0800 |
commit | 48d5d72fd76bbf615ea88fa9d5177471ed3d15a9 (patch) | |
tree | 987e36c6a8e3d801d188aeeef264ed9140e43764 | |
parent | d0cb6de41061be2a3eaecefe3bd7874e9a7470ff (diff) | |
download | uhd-48d5d72fd76bbf615ea88fa9d5177471ed3d15a9.tar.gz uhd-48d5d72fd76bbf615ea88fa9d5177471ed3d15a9.tar.bz2 uhd-48d5d72fd76bbf615ea88fa9d5177471ed3d15a9.zip |
mpm: adding destructor for UIO
UIO object now has an explicit destructor to properly tear down.
-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 |