diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c index ccad26b5339..f8d67561f26 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1446,6 +1446,18 @@ See `set-process-sentinel' for more info on sentinels. */) | |||
| 1446 | return XPROCESS (process)->sentinel; | 1446 | return XPROCESS (process)->sentinel; |
| 1447 | } | 1447 | } |
| 1448 | 1448 | ||
| 1449 | static void | ||
| 1450 | set_proc_thread (struct Lisp_Process *proc, struct thread_state *thrd) | ||
| 1451 | { | ||
| 1452 | eassert (THREADP (proc->thread) && XTHREAD (proc->thread) == thrd); | ||
| 1453 | eassert (proc->infd < FD_SETSIZE); | ||
| 1454 | if (proc->infd >= 0) | ||
| 1455 | fd_callback_info[proc->infd].thread = thrd; | ||
| 1456 | eassert (proc->outfd < FD_SETSIZE); | ||
| 1457 | if (proc->outfd >= 0) | ||
| 1458 | fd_callback_info[proc->outfd].thread = thrd; | ||
| 1459 | } | ||
| 1460 | |||
| 1449 | DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread, | 1461 | DEFUN ("set-process-thread", Fset_process_thread, Sset_process_thread, |
| 1450 | 2, 2, 0, | 1462 | 2, 2, 0, |
| 1451 | doc: /* Set the locking thread of PROCESS to be THREAD. | 1463 | doc: /* Set the locking thread of PROCESS to be THREAD. |
| @@ -1466,12 +1478,7 @@ If THREAD is nil, the process is unlocked. */) | |||
| 1466 | 1478 | ||
| 1467 | proc = XPROCESS (process); | 1479 | proc = XPROCESS (process); |
| 1468 | pset_thread (proc, thread); | 1480 | pset_thread (proc, thread); |
| 1469 | eassert (proc->infd < FD_SETSIZE); | 1481 | set_proc_thread (proc, tstate); |
| 1470 | if (proc->infd >= 0) | ||
| 1471 | fd_callback_info[proc->infd].thread = tstate; | ||
| 1472 | eassert (proc->outfd < FD_SETSIZE); | ||
| 1473 | if (proc->outfd >= 0) | ||
| 1474 | fd_callback_info[proc->outfd].thread = tstate; | ||
| 1475 | 1482 | ||
| 1476 | return thread; | 1483 | return thread; |
| 1477 | } | 1484 | } |
| @@ -2261,6 +2268,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2261 | && !EQ (p->filter, Qt)) | 2268 | && !EQ (p->filter, Qt)) |
| 2262 | add_process_read_fd (inchannel); | 2269 | add_process_read_fd (inchannel); |
| 2263 | 2270 | ||
| 2271 | set_proc_thread (p, current_thread); | ||
| 2272 | |||
| 2264 | specpdl_ref count = SPECPDL_INDEX (); | 2273 | specpdl_ref count = SPECPDL_INDEX (); |
| 2265 | 2274 | ||
| 2266 | /* This may signal an error. */ | 2275 | /* This may signal an error. */ |