]> git.eshelyaron.com Git - emacs.git/commitdiff
document process-thread and set-process-thread
authorTom Tromey <tromey@redhat.com>
Thu, 23 Aug 2012 07:06:11 +0000 (01:06 -0600)
committerTom Tromey <tromey@redhat.com>
Thu, 23 Aug 2012 07:06:11 +0000 (01:06 -0600)
doc/lispref/processes.texi

index 217f9f9eaeedde778f615c0afe5b475a63cf55c8..80a3d0f985dc46f15dcb419263f6327a98894609 100644 (file)
@@ -1174,6 +1174,7 @@ shell command.
 * Filter Functions::        Filter functions accept output from the process.
 * Decoding Output::         Filters can get unibyte or multibyte strings.
 * Accepting Output::        How to wait until process output arrives.
+* Processes and Threads::   How processes and threads interact.
 @end menu
 
 @node Process Buffers
@@ -1504,6 +1505,35 @@ did get some output, or @code{nil} if the timeout expired before output
 arrived.
 @end defun
 
+@node Processes and Threads
+@subsection Processes and Threads
+@cindex processes, threads
+
+  Because threads were a relatively late addition to Emacs Lisp, and
+due to the way dynamic binding was sometimes used in conjunction with
+@code{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
+@code{accept-process-output} or @code{sit-for} returns.
+
+  If the thread exits, all the processes locked to it are unlocked.
+
+@defun process-thread process
+Return the thread to which @var{process} is locked.  If @var{process}
+is unlocked, return @code{nil}.
+@end defun
+
+@defun set-process-thread process thread
+Set the locking thread of @var{process} to @var{thread}.  @var{thread}
+may be @code{nil}, in which case the process is unlocked.
+@end defun
+
 @node Sentinels
 @section Sentinels: Detecting Process Status Changes
 @cindex process sentinel