From: Sebastien Marie Subject: Re: tog: pthread_cond_destroy: Invalid argument To: Christian Weisgerber Cc: gameoftrees@openbsd.org Date: Wed, 11 Nov 2020 20:23:23 +0100 On Wed, Nov 11, 2020 at 07:34:57PM +0100, Christian Weisgerber wrote: > On FreeBSD, when I hit ^L in the log view, tog(1) dies right away with > > tog: pthread_cond_destroy: Invalid argument > > This doesn't happen on OpenBSD. > *scratches head* when ^L is hitted, stop_log_thread() is called, and it is calling pthread_cond_destroy(&s->thread_args.need_commits). I quickly look at the code, and it seems pthread_cond_destroy() could be called multiple time without corresponding pthread_cond_init(). regarding openbsd behaviour, pthread_cond_destroy() is callable multiple times on already destroyed condvar (like calling free(NULL)). on freebsd, it detects the condvar is already destroyed and error out (https://github.com/freebsd/freebsd/blob/60e92f3b783f5d6aeefe15bb193e504ac38968a2/lib/libthr/thread/thr_cond.c#L183). so it should be a problem in got, and us libc doesn't helped us :) -- Sebastien Marie