Subject: bug#36609: 27.0.50; Possible race-condition in threading implementation

From: Eli Zaretskii <[email-masked]>
Date: Sat, 13 Jul 2019 18:54:40 +0300

> Date: Sat, 13 Jul 2019 18:03:35 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> But I still would like to understand why we need to maintain a flag
> per thread.

Specifically, why not make this flag thread-independent, and have any
thread release the context lock if that variable is non-zero?  I don't
think it matters which thread locked the Glib context, we just need to
release it once we emerge from thread_select, and do it before we
might call Fsignal.  That the lock might be released by a thread other
than the one which locked it shouldn't matter, I think, as long as we
consider all the Lisp threads acting together on behalf of Emacs.