From 459329e0d02e7dfddf3619718568a4589dcf60f5 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 22 Feb 2023 10:16:01 +0100 Subject: [PATCH] defined why2_clean_threads meow --- src/chat/misc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/chat/misc.c b/src/chat/misc.c index e7398ed..80d6a3a 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -211,4 +211,20 @@ void *why2_accept_thread(void *socket) pthread_create(&thread, NULL, why2_communicate_thread, &connection_buffer); } +} + +void why2_clean_threads(void) +{ + if (head == NULL) return; //EMPTY LIST + + node_t *node_buffer = head; + node_t *node_buffer_2; + + while (node_buffer -> next != NULL) //GO TROUGH LIST + { + node_buffer_2 = node_buffer; + node_buffer = node_buffer -> next; + + remove_node(node_buffer_2); //REMOVE + } } \ No newline at end of file