diff options
author | Matt Strapp <strap012@umn.edu> | 2020-11-18 09:31:55 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-11-18 09:31:55 -0600 |
commit | 3ff5dea2e41f75b3f81d0777c721dd2bb86b257a (patch) | |
tree | 1ed4240311b711921a4ca54b69556754ec769bf9 /P3 | |
parent | valrgind still sad (diff) | |
download | csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.tar csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.tar.gz csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.tar.bz2 csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.tar.lz csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.tar.xz csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.tar.zst csci4061-3ff5dea2e41f75b3f81d0777c721dd2bb86b257a.zip |
aaaaaaaaaaaaaaaaaaaa
Diffstat (limited to '')
-rw-r--r-- | P3/.vscode/launch.json | 2 | ||||
-rw-r--r-- | P3/server.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/P3/.vscode/launch.json b/P3/.vscode/launch.json index 7efdc59..9890b76 100644 --- a/P3/.vscode/launch.json +++ b/P3/.vscode/launch.json @@ -9,7 +9,7 @@ "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/web_server", - "args": ["9000", "testing", "10", "10", "0", "26", "0"], + "args": ["9000", "testing", "10", "1", "0", "99", "0"], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/P3/server.c b/P3/server.c index 8838293..b13d7fc 100644 --- a/P3/server.c +++ b/P3/server.c @@ -188,6 +188,7 @@ void * dispatch(void *arg) { } tempNode->fd = newReq; tempNode->request = dispatchBuf; + tempNode->next = NULL; Q = tempNode; pthread_mutex_unlock(&Qlock); break; @@ -214,7 +215,6 @@ void * worker(void *arg) { pthread_mutex_unlock(&Qlock); continue; } - //Make copy of request and get rid of old one. request_t *request = NULL; request = (request_t*) malloc(sizeof(request_t)); @@ -336,10 +336,13 @@ int main(int argc, char **argv) { pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); // Start the server init(port); + char threadName[16]; // Create dispatcher threads (make detachable????) pthread_t dThreads[dispatchers]; for (int i=0; i<dispatchers; i++) { pthread_create(&dThreads[i], &attr, dispatch, NULL); // DEBUG! figure out last arg + sprintf(threadName, "Dispatch %d", i); + pthread_setname_np(dThreads[i], threadName); } //Create workers (make detachable?????) pthread_t wThreads[workers]; @@ -347,12 +350,15 @@ int main(int argc, char **argv) { for (int i = 0; i < workers; i++) { Wargs[i]=i; pthread_create(&wThreads[i], &attr, worker, (void *) &Wargs[i]); //TODO: Worker arguments - } + sprintf(threadName, "Worker %d", i); + pthread_setname_np(wThreads[i], threadName); + } free(Wargs); // Create dynamic pool manager thread (extra credit A) if (dynFlag) { pthread_t pThread; pthread_create(&pThread, &attr, dynamic_pool_size_update, NULL); //TODO: possible arguments + pthread_setname_np(pThread, "Pool Manager"); } //Server loop (RUNS FOREVER) |