Eli Zaretskii wrote: > what if another thread > is waiting on the keyboard descriptor and wants to handle keyboard > input, or wants to receive X events? That depends on what is meant by "waiting on the keyboard descriptor" and "wants to receive X events". At the low level, if the other thread was not involved in delivering the signal and is calling pselect on the keyboard descriptor while keyboard input occurs, pselect will return successfully without being interrupted. Similarly for X events, I assume. >> On GNU/Linux, process signals get sent to the main thread unless the main thread >> is blocking them (or if a few less-common situations arise, e.g., the main >> thread is exiting). > And what happens in those exceptional cases? Typically the signal gets sent to some other thread. (There are exceptions to this, too; it's complicated.) >> Hmm, I see that the recent changes use mixed terminology. Until now, Emacs has >> called the initial thread the "main thread", but the recent code sometimes calls >> it the "primary thread". We shouldn't have two names for the same thing. I'll >> look into fixing that. > "Primary thread" is the name of the main thread. How so? Threads don't have names in Emacs. In POSIX it's called the "initial thread". Emacs has long used "main thread" internally to describe the same thing; this is a common alternative name, and it's shorter so it's OK as long as we're consistent about it. Using a *third* phrase "primary thread" for the same thing in some places adds needless confusion. Evidently the longstanding variable named main_thread (which is a thread ID) got in the way of the names that thread.c should have used, and thread.c instead used names like "primary_thread". I'll try to lessen the confusion by changing the longstanding variable name to "main_thread_id" (which is more-accurate anyway). This will give thread.c the freedom to use names like "main_thread" for its own purposes. Also, it'll avoid an unnecessary duplicate of the main thread ID in emacs-module.c. I installed the attached patch to do all this.