wm: glendy

Download patch

ref: 4ee5566fd6c741be9d93d5282f87a07a2a7b3008
parent: 7f13f927aad71be1b7131428197cc02f7a584741
author: mkf <mkf@cloud9p.org>
date: Mon May 13 04:32:46 EDT 2024

srv: go threads go! (use threads forinput

--- a/srv.c
+++ b/srv.c
@@ -395,7 +395,7 @@
 {
 	int listenfd, port, result;
 	char r;
-//	pthread_t thread;
+	pthread_t input_thread;
 	
 	/* it might not be a real human */
 	ptype[0] = Human;
@@ -405,7 +405,6 @@
 	
 	listenfd = setuplistener(port);
 	pthread_mutex_init(&pcount_mutex, NULL);
-//	pthread_mutex_init(&print_mutex, NULL);
 	
 	
 	/* OpenBSD ignores this */
@@ -413,12 +412,12 @@
 	
 
 	
-/*	result = pthread_create(&thread, NULL, (void*)input, NULL);
-//	if(result){
-//               printf("Thread creation failed with return code %d\n", result);
-//                exit(-1);
-//	}
-*/
+	result = pthread_create(&input_thread, NULL, (void*)input, NULL);
+	if(result){
+		dprint("Thread creation failed with return code %d\n", result);
+		exit(-1);
+	}
+
 	for(;;)
 	{
 		getclients(listenfd);
@@ -433,6 +432,5 @@
 	}
 	close(listenfd);
 	pthread_mutex_destroy(&pcount_mutex);
-//	pthread_mutex_destroy(&print_mutex);
 	return 0;
 }