From 40769053abe6fd40552b4add7f457f921ce8cd6a Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 7 Feb 2006 07:20:48 +0000
Subject: [PATCH] Eliminate yet another unnecessary call to RingBufFull().

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

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 43146fdc29..0613c93723 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -1504,17 +1504,16 @@ void output_thread(void* arg)
 		 */
 		if(bufbot == buftop) {
 			/* Wait for something to output in the RingBuffer */
-			if(RingBufFull(&sbbs->outbuf)==0) {	/* empty */
+			if((avail=RingBufFull(&sbbs->outbuf))==0) {	/* empty */
 				if(sem_trywait_block(&sbbs->outbuf.sem,1000))
 					continue;
+				/* Check for spurious sem post... */
+				if((avail=RingBufFull(&sbbs->outbuf))==0)
+					continue;
 			}
 			else
 				sem_trywait(&sbbs->outbuf.sem);
 
-			/* Check for spurious sem post... */
-			if((avail=RingBufFull(&sbbs->outbuf))==0)
-				continue;
-
 			/* Wait for full buffer or drain timeout */
 			if(sbbs->outbuf.highwater_mark) {
 				if(avail<sbbs->outbuf.highwater_mark)
-- 
GitLab