From eac0c934dc45edb5efac09019637372d14142786 Mon Sep 17 00:00:00 2001 From: Dane MacFadden Date: Tue, 15 Jul 2025 11:42:10 -0600 Subject: [PATCH] fixed bug in output and sender --- main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 8c4c36f..b39a0c8 100644 --- a/main.c +++ b/main.c @@ -38,7 +38,7 @@ void *input(void *arg) { } void *sender(void *arg) { - char *msg; + char msg[30]; while (1) { pthread_mutex_lock(&sendmut); if (ListCount(sendlist) != 0) { @@ -74,11 +74,9 @@ void *output(void *arg) { ListFirst(receivelist); strcpy(msg, ListCurr(receivelist)); ListRemove(receivelist); + printf("%s\n", msg); } pthread_mutex_unlock(&receivemut); - if (ListCount(receivelist) != 0) { - printf("%s\n", msg); - } } return 0;