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

From: [email-masked]
Date: Sun, 06 Jun 2021 15:10:43 -0400

EZ> This will bring back bug#36609, so we cannot do that without
EZ> discussing first why you think that commit was wrong.

By enforcing bijection between acquires and releases in xgselect.c --
cavalierly so as the releases now come out-of-band from another module
thread.c -- commit 9c62ffb admits deadlock.  The conditions under which that
happens are not at all rarefied as evidenced by `for i in 1 2 3 ; do src/emacs
-Q -l ./42.el & done ;`

Generally, a commit made to remedy a phantom problem should always be
suspect.  In this case OP was squatting on the main thread, so he deserves
what he got.

EZ> Yes, race conditions can be solved by using sleep-for, but that's not
EZ> really a clean solution, at least not in my book.

Case #4 was not meant to solve anything, only to set OP straight on what he
really wanted.  You can remove the sleep-for.  Still works under patch #1.