def lock_host(func, *args, **kwargs):
 def inner(self, *args, **kwargs):
  self.host_lock.acquire()
  try:
   res = func(self, *args, **kwargs)
   self.host_lock.release()
  except Exception as e:
   self.host_lock.release()
   raise e
  return res
 return inner

def lock_host ( func , * args , ** kwargs ) : def inner ( self , * args , ** kwargs ) : self . host_lock . acquire ( ) try : res = func ( self , * args , ** kwargs ) self . host_lock . release ( ) except Exception as e : self . host_lock . release ( ) raise e return res return inner
a decorator that acquires a lock before accessing the debugger to avoid api locking related errors with the debugger host .