From 82487cd6d6e9caf64e3fb05a2c06008a43dee9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 6 Mar 2022 14:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server.c b/server.c index 8fe9d75..64bc4d1 100644 --- a/server.c +++ b/server.c @@ -86,7 +86,6 @@ static void accept_request(void *cli) { signal(SIGQUIT, handle_quit); signal(SIGPIPE, handle_quit); - pthread_detach(pthread_self()); numchars = get_line(client, buf, sizeof(buf)); j = 0; @@ -523,7 +522,7 @@ static void unimplemented(int client) { static pthread_attr_t attr; static int accept_client(int is_unix_sock) { pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, 1); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); signal(SIGCHLD, SIG_IGN); while(1) { socklen_t client_name_len = sizeof(client_name);