aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen2016-02-24 17:21:50 +1100
committerLars Ingebrigtsen2016-02-24 17:21:50 +1100
commitdcf9eee5f1edac19f8421dc71bd11a843aaa919e (patch)
tree8631de04a58da4e957a90c4baffa8eaa3b9502ff /src/process.c
parent9aac47f42ef0f6a874443142bb2b7484443d98dc (diff)
downloademacs-dcf9eee5f1edac19f8421dc71bd11a843aaa919e.tar.gz
emacs-dcf9eee5f1edac19f8421dc71bd11a843aaa919e.zip
Make setting the coding system non-blocking
* src/process.c (Fset_process_filter_multibyte): Defer completing coding system setup in asynchronous processes. (Fset_process_coding_system): Ditto.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/process.c b/src/process.c
index b8e1973601b..8c88e62ee05 100644
--- a/src/process.c
+++ b/src/process.c
@@ -7159,28 +7159,24 @@ DEFUN ("set-process-coding-system", Fset_process_coding_system,
7159 Sset_process_coding_system, 1, 3, 0, 7159 Sset_process_coding_system, 1, 3, 0,
7160 doc: /* Set coding systems of PROCESS to DECODING and ENCODING. 7160 doc: /* Set coding systems of PROCESS to DECODING and ENCODING.
7161DECODING will be used to decode subprocess output and ENCODING to 7161DECODING will be used to decode subprocess output and ENCODING to
7162encode subprocess input. 7162encode subprocess input. */)
7163
7164If PROCESS is a non-blocking network process that hasn't been fully
7165set up yet, this function will block until socket setup has completed. */)
7166 (Lisp_Object process, Lisp_Object decoding, Lisp_Object encoding) 7163 (Lisp_Object process, Lisp_Object decoding, Lisp_Object encoding)
7167{ 7164{
7168 CHECK_PROCESS (process); 7165 CHECK_PROCESS (process);
7169 7166
7170 if (NETCONN_P (process))
7171 wait_for_socket_fds (process, "set-process-coding-system");
7172
7173 struct Lisp_Process *p = XPROCESS (process); 7167 struct Lisp_Process *p = XPROCESS (process);
7174 7168
7175 if (p->infd < 0)
7176 error ("Input file descriptor of %s closed", SDATA (p->name));
7177 if (p->outfd < 0)
7178 error ("Output file descriptor of %s closed", SDATA (p->name));
7179 Fcheck_coding_system (decoding); 7169 Fcheck_coding_system (decoding);
7180 Fcheck_coding_system (encoding); 7170 Fcheck_coding_system (encoding);
7181 encoding = coding_inherit_eol_type (encoding, Qnil); 7171 encoding = coding_inherit_eol_type (encoding, Qnil);
7182 pset_decode_coding_system (p, decoding); 7172 pset_decode_coding_system (p, decoding);
7183 pset_encode_coding_system (p, encoding); 7173 pset_encode_coding_system (p, encoding);
7174
7175 /* If the sockets haven't been set up yet, the final setup part of
7176 this will be called asynchronously. */
7177 if (p->infd < 0 || p->outfd < 0)
7178 return Qnil;
7179
7184 setup_process_coding_systems (process); 7180 setup_process_coding_systems (process);
7185 7181
7186 return Qnil; 7182 return Qnil;
@@ -7207,13 +7203,16 @@ suppressed. */)
7207{ 7203{
7208 CHECK_PROCESS (process); 7204 CHECK_PROCESS (process);
7209 7205
7210 if (NETCONN_P (process))
7211 wait_for_socket_fds (process, "set-process-filter-multibyte");
7212
7213 struct Lisp_Process *p = XPROCESS (process); 7206 struct Lisp_Process *p = XPROCESS (process);
7214 if (NILP (flag)) 7207 if (NILP (flag))
7215 pset_decode_coding_system 7208 pset_decode_coding_system
7216 (p, raw_text_coding_system (p->decode_coding_system)); 7209 (p, raw_text_coding_system (p->decode_coding_system));
7210
7211 /* If the sockets haven't been set up yet, the final setup part of
7212 this will be called asynchronously. */
7213 if (p->infd < 0 || p->outfd < 0)
7214 return Qnil;
7215
7217 setup_process_coding_systems (process); 7216 setup_process_coding_systems (process);
7218 7217
7219 return Qnil; 7218 return Qnil;