MCPcopy Index your code
hub / github.com/agent0ai/agent-zero / terminate

Method terminate

helpers/defer.py:43–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 self.loop.run_forever()
42
43 def terminate(self):
44 loop = getattr(self, "loop", None)
45 thread = getattr(self, "thread", None)
46
47 if not loop:
48 return
49
50 if loop.is_running():
51 if thread and thread is threading.current_thread():
52 loop.stop()
53 else:
54 loop.call_soon_threadsafe(loop.stop)
55 if thread:
56 thread.join()
57 elif thread and thread.is_alive() and thread is not threading.current_thread():
58 thread.join()
59
60 if not loop.is_closed():
61 loop.close()
62
63 with self.__class__._lock:
64 if self.thread_name in self.__class__._instances:
65 del self.__class__._instances[self.thread_name]
66
67 self.loop = None
68 self.thread = None
69
70 def run_coroutine(self, coro):
71 self._start()

Callers 7

_terminate_processMethod · 0.45
killMethod · 0.45
start_tailscaledFunction · 0.45
run_tailscale_upFunction · 0.45
terminate_processFunction · 0.45
deFunction · 0.45

Calls 5

is_runningMethod · 0.45
stopMethod · 0.45
joinMethod · 0.45
is_aliveMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected