From c6a7ae3f1c3881713cf62460deaae0cd79a1d089 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 16 Nov 2020 08:59:44 -0600 Subject: help me --- P3/server.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'P3') diff --git a/P3/server.c b/P3/server.c index 2f1b30b..93c28ed 100644 --- a/P3/server.c +++ b/P3/server.c @@ -111,13 +111,14 @@ int readFromDisk(/*necessary arguments*/) { void * dispatch(void *arg) { while (1) { - // Accept client connection + int newReq = accept_connection(); + if (newReq >= 0) { + // Get request from the client + //get_request(newReq, something); + // Add the request into the queue - // Get request from the client - - // Add the request into the queue - + } } return NULL; } @@ -226,22 +227,25 @@ int main(int argc, char **argv) { } } + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); // Start the server init(port); // Create dispatcher threads (make detachable????) pthread_t dThreads[dispatchers]; for (int i=0; i