From: Stefan Sperling Subject: Re: tog yield commit reverted To: Martin Pieuchot Cc: gameoftrees@openbsd.org Date: Tue, 4 Feb 2020 11:13:52 +0100 On Tue, Feb 04, 2020 at 10:58:43AM +0100, Martin Pieuchot wrote: > On 03/02/20(Mon) 19:13, Stefan Sperling wrote: > > FYI, > > > > I had to revert commit 6b8a2b8fcd99 because it broke tog search. > > It's quite likely that this could be fixed differently? > > That means pthread_yield() is used for synchronisation, which isn't > guaranteed. > > Do you have more details about the "breakage"? Where was the other > thread stuck? Or why couldn't it make progress? You should be able to reproduce by running tog in /usr/src. Then search for commits from some developer (mpi or stsp) and try to move through the search with the 'n' key. Eventually you will hit it. Tog ends up spinning on the CPU in the main thread, which keeps drawing the log view over and over again and doesn't realize that the next match has (apparently) been found. And the log thread is sleeping here: 1929 else if (a->commits_needed == 0) { 1930 errcode = pthread_cond_wait(&a->need_commits, 1931 &tog_mutex);