On Sun, 15 Jul 2018 14:42:23 +0200 Paolo Bonzini <pbonz...@redhat.com> wrote:
> On 13/07/2018 20:42, Stefan Hajnoczi wrote: > > +#ifndef _WIN32 > > +static void stop_writeout_thread(void) > > +{ > > + g_mutex_lock(&trace_lock); > > + trace_writeout_running = false; > > + g_cond_signal(&trace_available_cond); > > + g_mutex_unlock(&trace_lock); > > + > > + g_thread_join(trace_writeout_thread); > > + trace_writeout_thread = NULL; > > +} > > After stop_writeout_thread returns, another could start a write to the > shared data structure---and the write would never finish, because the > thread disappears after fork(2) returns. This would leave the mutex > locked, causing a deadlock soon after the fork. So you need to lock > trace_lock again here, and unlock it in restart_writeout_thread. So, I suppose there will be a v3, right? > > Apart from this, it looks good! Did a quick run and it fixed the problems for me.