Because threads were a relatively late addition to Emacs Lisp, and
due to the way dynamic binding was sometimes used in conjunction with
accept-process-output, by default a process is locked to the
thread that created it. When a process is locked to a thread, output
from the process can only be accepted by that thread.
A Lisp program can specify to which thread a process is to be
locked, or instruct Emacs to unlock a process, in which case its
output can be processed by any thread. Only a single thread will wait
for output from a given process at one time—once one thread begins
waiting for output, the process is temporarily locked until
If the thread exits, all the processes locked to it are unlocked.
Return the thread to which process is locked. If process
is unlocked, return
Set the locking thread of process to thread. thread
nil, in which case the process is unlocked.