revert 6b8a2b8fcd99c4365b1aa9513c0f0149beac2491; it broke 'n' (search next) In the log view, 'n' sometimes failed to search for the next matching commit and tog dead-locked. So a yield or mutex unlock/lock is required for search to work. Perhaps we need a different fix?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/tog/tog.c b/tog/tog.c
index ca95914..99c464b 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -755,6 +755,15 @@ view_input(struct tog_view **new, struct tog_view **dead,
*focus = NULL;
if (view->searching && !view->search_next_done) {
+ errcode = pthread_mutex_unlock(&tog_mutex);
+ if (errcode)
+ return got_error_set_errno(errcode,
+ "pthread_mutex_unlock");
+ pthread_yield();
+ errcode = pthread_mutex_lock(&tog_mutex);
+ if (errcode)
+ return got_error_set_errno(errcode,
+ "pthread_mutex_lock");
view->search_next(view);
return NULL;
}
@@ -1633,6 +1642,16 @@ trigger_log_thread(int load_all, int *commits_needed, int *log_complete,
if (errcode)
return got_error_set_errno(errcode,
"pthread_cond_signal");
+ errcode = pthread_mutex_unlock(&tog_mutex);
+ if (errcode)
+ return got_error_set_errno(errcode,
+ "pthread_mutex_unlock");
+ pthread_yield();
+ errcode = pthread_mutex_lock(&tog_mutex);
+ if (errcode)
+ return got_error_set_errno(errcode,
+ "pthread_mutex_lock");
+
if (*commits_needed > 0 && (!load_all || --max_wait <= 0)) {
/*
* Thread is not done yet; lose a key press