diff --git a/axclrt/session.py b/axclrt/session.py index a8cf15a..9706b85 100644 --- a/axclrt/session.py +++ b/axclrt/session.py @@ -148,6 +148,12 @@ def _sub_init(self): def __del__(self): self._final() + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self._final() + def _prepare_io(self, grp_id, io_info, io, io_data, strategy): self._rt_lib.memset(io_data, 0, self._rt_ffi.sizeof('AXCL_IO_DATA_T'))