aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorEli Zaretskii2025-09-05 08:52:05 +0300
committerEli Zaretskii2025-09-05 08:52:05 +0300
commit951e782836e68a3a7938a0703e7a275df0936b19 (patch)
treea53ec1614ca0f462903ecc4601f00b3bd772dd6e /src/process.c
parentfca0dbe0ab2930e39aaec304df3e6bb7cad17995 (diff)
downloademacs-951e782836e68a3a7938a0703e7a275df0936b19.tar.gz
emacs-951e782836e68a3a7938a0703e7a275df0936b19.zip
Fix locking to threads of the client network process
* src/process.c (server_accept_connection): Make the client process be locked to the same thread as the parent server process, or unlocked if the server process was unlocked. (Bug#79367)
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c
index d6efac5479d..fa003c29851 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5078,6 +5078,10 @@ server_accept_connection (Lisp_Object server, int channel)
5078 fcntl (s, F_SETFL, O_NONBLOCK); 5078 fcntl (s, F_SETFL, O_NONBLOCK);
5079 5079
5080 p = XPROCESS (proc); 5080 p = XPROCESS (proc);
5081 /* make_process calls pset_thread, but if the server process is not
5082 locked to any thread, we need to undo what make_process did. */
5083 if (NILP (ps->thread))
5084 pset_thread (p, Qnil);
5081 5085
5082 /* Build new contact information for this setup. */ 5086 /* Build new contact information for this setup. */
5083 contact = Fcopy_sequence (ps->childp); 5087 contact = Fcopy_sequence (ps->childp);
@@ -5117,6 +5121,17 @@ server_accept_connection (Lisp_Object server, int channel)
5117 add_process_read_fd (s); 5121 add_process_read_fd (s);
5118 if (s > max_desc) 5122 if (s > max_desc)
5119 max_desc = s; 5123 max_desc = s;
5124 /* If the server process is locked to this thread, lock the client
5125 process to the same thread, otherwise clear the thread of its I/O
5126 descriptors. */
5127 eassert (!fd_callback_info[p->infd].thread);
5128 if (NILP (ps->thread))
5129 set_proc_thread (p, NULL);
5130 else
5131 {
5132 eassert (XTHREAD (ps->thread) == current_thread);
5133 set_proc_thread (p, XTHREAD (ps->thread));
5134 }
5120 5135
5121 /* Setup coding system for new process based on server process. 5136 /* Setup coding system for new process based on server process.
5122 This seems to be the proper thing to do, as the coding system 5137 This seems to be the proper thing to do, as the coding system