aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-15 13:57:45 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-15 13:57:45 -0600
commit5bc3a220d949de53885122e2878ba975f4390eef (patch)
tree89bfc60d996ab9106b82558f3976acf54b764ced
parenthelp (diff)
downloadcsci4061-5bc3a220d949de53885122e2878ba975f4390eef.tar
csci4061-5bc3a220d949de53885122e2878ba975f4390eef.tar.gz
csci4061-5bc3a220d949de53885122e2878ba975f4390eef.tar.bz2
csci4061-5bc3a220d949de53885122e2878ba975f4390eef.tar.lz
csci4061-5bc3a220d949de53885122e2878ba975f4390eef.tar.xz
csci4061-5bc3a220d949de53885122e2878ba975f4390eef.tar.zst
csci4061-5bc3a220d949de53885122e2878ba975f4390eef.zip
bruh
-rw-r--r--P3/server.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/P3/server.c b/P3/server.c
index 4c5fd20..6aa24e6 100644
--- a/P3/server.c
+++ b/P3/server.c
@@ -179,16 +179,20 @@ int main(int argc, char **argv) {
mkdir(cache, 0666);
// Start the server
init(port);
- // Create dispatcher and worker threads (all threads should be detachable)
+ // Create dispatcher threads (make detachable????)
pthread_t dThreads[dispatchers];
- pthread_create(&dThreads, NULL, dispatch, NULL); // DEBUG! figure out last arg
-
+ for (int i=0; i<dispatchers; i++) {
+ pthread_create(&dThreads[i], NULL, dispatch, NULL); // DEBUG! figure out last arg
+ }
+ //Create workers (make detachable?????)
pthread_t wThreads[workers];
- pthread_create(&wThreads, NULL, worker, NULL); //TODO: Worker arguments.
-
+ for (int i = 0; i < workers; i++) {
+ pthread_create(&wThreads[i], NULL, worker, NULL); //TODO: Worker arguments
+ }
// Create dynamic pool manager thread (extra credit A)
-
- //Server loop (RUNS FOREVER)
+ pthread_t pThread;
+ pthread_create(pThread, NULL, dynamic_pool_size_update, NULL);
+ //Server loop (RUNS FOREVER)
while (1) {
//TODO: Add something else?
@@ -203,7 +207,6 @@ int main(int argc, char **argv) {
printf("All threads have been successfully killed and cache has successfully been cleared.\nExiting now.\n");
return 0;
}
-
}
printf("This should never be printed.");
return 42;