From 6e5a07ed1c4f89959b7bad398e5ae652318f28ea Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 18 Nov 2004 02:30:57 +0000
Subject: [PATCH] Added YIELD() to input_thread_mutex lock/unlock loop in
 input_thread(), required on some Linux distros to allow other threads to be
 able to lock the mutex.

---
 src/sbbs3/main.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index c727d0af92..0f1e28a0dd 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -1206,8 +1206,10 @@ void input_thread(void *arg)
 		if((i=select(high_socket+1,&socket_set,NULL,NULL,&tv))<1) {
 			if(pthread_mutex_unlock(&sbbs->input_thread_mutex)!=0)
 				sbbs->errormsg(WHERE,ERR_UNLOCK,"input_thread_mutex",0);
-			if(i==0)
-				continue;
+			if(i==0) {
+				YIELD();	/* This kludge is necessary on some Linux distros */
+				continue;	/* to allow other threads to lock the input_thread_mutex */
+			}
 
 			if(sbbs->client_socket==INVALID_SOCKET)
 				break;
-- 
GitLab