mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Make sure 'make-process' locks the process to the current thread
* src/process.c (set_proc_thread): New function. (Fset_process_thread, create_process): Use it.
This commit is contained in:
parent
37325ed5a9
commit
c93be71e45
1 changed files with 15 additions and 6 deletions
|
|
@ -1446,6 +1446,18 @@ See `set-process-sentinel' for more info on sentinels. */)
|
||||||
return XPROCESS (process)->sentinel;
|
return XPROCESS (process)->sentinel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_proc_thread (struct Lisp_Process *proc, struct thread_state *thrd)
|
||||||
|
{
|
||||||
|
eassert (THREADP (proc->thread) && XTHREAD (proc->thread) == thrd);
|
||||||
|
eassert (proc->infd < FD_SETSIZE);
|
||||||
|
if (proc->infd >= 0)
|
||||||
|
fd_callback_info[proc->infd].thread = thrd;
|
||||||
|
eassert (proc->outfd < FD_SETSIZE);
|
||||||
|
if (proc->outfd >= 0)
|
||||||
|
fd_callback_info[proc->outfd].thread = thrd;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread,
|
DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread,
|
||||||
2, 2, 0,
|
2, 2, 0,
|
||||||
doc: /* Set the locking thread of PROCESS to be THREAD.
|
doc: /* Set the locking thread of PROCESS to be THREAD.
|
||||||
|
|
@ -1466,12 +1478,7 @@ If THREAD is nil, the process is unlocked. */)
|
||||||
|
|
||||||
proc = XPROCESS (process);
|
proc = XPROCESS (process);
|
||||||
pset_thread (proc, thread);
|
pset_thread (proc, thread);
|
||||||
eassert (proc->infd < FD_SETSIZE);
|
set_proc_thread (proc, tstate);
|
||||||
if (proc->infd >= 0)
|
|
||||||
fd_callback_info[proc->infd].thread = tstate;
|
|
||||||
eassert (proc->outfd < FD_SETSIZE);
|
|
||||||
if (proc->outfd >= 0)
|
|
||||||
fd_callback_info[proc->outfd].thread = tstate;
|
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
@ -2261,6 +2268,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
|
||||||
&& !EQ (p->filter, Qt))
|
&& !EQ (p->filter, Qt))
|
||||||
add_process_read_fd (inchannel);
|
add_process_read_fd (inchannel);
|
||||||
|
|
||||||
|
set_proc_thread (p, current_thread);
|
||||||
|
|
||||||
specpdl_ref count = SPECPDL_INDEX ();
|
specpdl_ref count = SPECPDL_INDEX ();
|
||||||
|
|
||||||
/* This may signal an error. */
|
/* This may signal an error. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue