From: Stefan Sperling Subject: Re: tog log & got-read-pack on the fly: To: Martin Pieuchot Cc: gameoftrees@openbsd.org Date: Fri, 11 Oct 2019 10:52:24 +0200 On Fri, Oct 11, 2019 at 10:28:54AM +0200, Martin Pieuchot wrote: > With this diff I can still reproduce a freeze if I search for a pattern > that is never matched. tog(1) keeps 'searching' without displaying > anything and without answering to any key pressed. I cannot reproduce this, sadly. I have tried on 3 different machines. To get the display updated, the main thread must wake from wgetch() (due to halfdelay(10) this should happen once per second), grab the tog_mutex, and redraw the display. Can you please try to figure out where the main thread hangs on your machine? Does this help? I doubt so since repeated mutex lock/unlock in both threads should already have the desired effect. diff 7d5fb7e82303b4affede22230a8763512045838f /home/stsp/src/got blob - 082650a7623054ef35d2d467e3d678240ee3ddf3 file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -1270,6 +1270,10 @@ queue_commits(struct got_commit_graph *graph, struct c if (have_match) break; + else { + /* Allow main thread to update progress display. */ + pthread_yield(); + } } return err;