Commit Diff


commit - 15a087fe57324ab65b6527daace23842e1012306
commit + 88048b5421d16705b805b122112186bf71492590
blob - 336187b3c54e4924e866a5793764ae26ae6de7ea
blob + 898e19a0347debedcdba5bf3e94bb42ece234412
--- tog/tog.c
+++ tog/tog.c
@@ -1209,16 +1209,26 @@ scroll_down(struct commit_queue_entry **first_displaye
 
 	do {
 		pentry = TAILQ_NEXT(*last_displayed_entry, entry);
-		if (pentry == NULL) {
+		while (pentry == NULL) {
 			int errcode;
 			if (*log_complete)
-				return NULL;
+				break;
 			*commits_needed = maxscroll + 20;
 			errcode = pthread_cond_signal(need_commits);
 			if (errcode)
 				return got_error_set_errno(errcode);
-			return NULL;
+			errcode = pthread_mutex_unlock(&tog_mutex);
+			if (errcode)
+				return got_error_set_errno(errcode);
+			pthread_yield();
+			errcode = pthread_mutex_lock(&tog_mutex);
+			if (errcode)
+				return got_error_set_errno(errcode);
+			pentry = TAILQ_NEXT(*last_displayed_entry, entry);
 		}
+		if (pentry == NULL)
+			break;
+
 		*last_displayed_entry = pentry;
 
 		pentry = TAILQ_NEXT(*first_displayed_entry, entry);