lisa.trace: Make Trace a context manager
FEATURE lisa.trace.Trace objects have to manage some cache-related resources, which can require orderly cleanup in some situations (e.g. if the caller intends on removing the trace.dat folder after it is done with the Trace). Relying on __del__ for that does not work as cyclic references to the Trace instance make __del__ execute at an unknown point in the future. Fix that by providing a context manager API to Trace, which can be used in this sort of situation. The cleanup code will still attempt to run on __del__ if it has not run yet for backward compatibility and simpler situations.
Loading
Please register or sign in to comment