fixed bug in output and sender
This commit is contained in:
@@ -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);
|
||||
}
|
||||
pthread_mutex_unlock(&receivemut);
|
||||
if (ListCount(receivelist) != 0) {
|
||||
printf("%s\n", msg);
|
||||
}
|
||||
pthread_mutex_unlock(&receivemut);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user