added thread deallocation to chat-server
This commit is contained in:
parent
49978a8a53
commit
4a298b94b3
@ -26,8 +26,8 @@ int main(void)
|
|||||||
{
|
{
|
||||||
int listen_socket = socket(AF_INET, SOCK_STREAM, 0); //CREATE SERVER SOCKET
|
int listen_socket = socket(AF_INET, SOCK_STREAM, 0); //CREATE SERVER SOCKET
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
size_t line_length_buffer;
|
size_t line_length_buffer = 0;
|
||||||
char *line_buffer;
|
char *line_buffer = NULL;
|
||||||
|
|
||||||
if (listen_socket < 0) why2_die("Failed creating socket.");
|
if (listen_socket < 0) why2_die("Failed creating socket.");
|
||||||
|
|
||||||
@ -58,10 +58,11 @@ int main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DEALLOCATION
|
||||||
why2_clean_threads();
|
why2_clean_threads();
|
||||||
|
|
||||||
free(line_buffer);
|
free(line_buffer);
|
||||||
close(listen_socket);
|
close(listen_socket);
|
||||||
|
pthread_cancel(thread);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user