🐛 在回收时关闭通道以节省资源

This commit is contained in:
远野千束 2024-10-14 20:40:14 +08:00
parent efa55473ff
commit 8a2f07fcf1

View File

@ -110,3 +110,9 @@ class Chan(Generic[T]):
Returns: Returns:
""" """
self.recv_conn, other.recv_conn = other.recv_conn, self.recv_conn self.recv_conn, other.recv_conn = other.recv_conn, self.recv_conn
def __del__(self):
"""
Close the channel when the object is deleted.
"""
self.close()