fixed bug in output and sender

This commit is contained in:
2025-07-15 11:42:10 -06:00
parent 288ec07147
commit eac0c934dc
+2 -4
View File
@@ -38,7 +38,7 @@ void *input(void *arg) {
} }
void *sender(void *arg) { void *sender(void *arg) {
char *msg; char msg[30];
while (1) { while (1) {
pthread_mutex_lock(&sendmut); pthread_mutex_lock(&sendmut);
if (ListCount(sendlist) != 0) { if (ListCount(sendlist) != 0) {
@@ -74,11 +74,9 @@ void *output(void *arg) {
ListFirst(receivelist); ListFirst(receivelist);
strcpy(msg, ListCurr(receivelist)); strcpy(msg, ListCurr(receivelist));
ListRemove(receivelist); ListRemove(receivelist);
printf("%s\n", msg);
} }
pthread_mutex_unlock(&receivemut); pthread_mutex_unlock(&receivemut);
if (ListCount(receivelist) != 0) {
printf("%s\n", msg);
}
} }
return 0; return 0;