commit 6b8a2b8fcd99c4365b1aa9513c0f0149beac2491 from: Martin Pieuchot date: Mon Jan 20 16:02:51 2020 UTC Remove unnecessary pthread_yield(3). In the two cases a context switch isn't necessary as the thread isn't blocked and doesn't need to wait for its sibling. commit - ac03cf6de8d2cfe0dfc55b106bac1fdaec929da6 commit + 6b8a2b8fcd99c4365b1aa9513c0f0149beac2491 blob - ac26de54f7e6abcc20ae785249eaa69b16e9718c blob + 0e878ef6ce29b0000c95413125693c2703caeeee --- tog/tog.c +++ tog/tog.c @@ -747,15 +747,6 @@ view_input(struct tog_view **new, struct tog_view **de *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; } @@ -1638,16 +1629,6 @@ trigger_log_thread(int load_all, int *commits_needed, 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