> Date: Tue, 21 Jan 2025 18:41:11 +0200
> From: Eli Zaretskii
> To: "Yue Yi"
> Cc: emacs-devel@gnu.org
I have completed an initial version. Please see the attached file.I
will add necessary comments and some error handling code.
The overall working principle of the code can be simply described as
creating multiple threads that concurrently call
WaitForMultipleObjects to wait for more than 64 objects. When a result
occurs or a timeout happens, the main thread notifies the other
threads to terminate via an event. Due to the quantity issue, some
constant macros had to be redefined.
After installing this patch and compiling, it allows a maximum of 1024
child processes. I tested it using the following code, which
simultaneously launched 100 ping commands.
(defun create-ping-process (index)
"Create a ping process for a given INDEX."
(let ((process-name (format "ping-process-%d" index))
(buffer-name (format "*ping-output-%d*" index))
(host "127.0.0.1"))
(start-process process-name buffer-name "ping" host)))
(defun create-multiple-ping-processes (count)
"Create COUNT ping processes."
(dotimes (i count)
(create-ping-process i)))
(create-multiple-ping-processes 100)
> > > I'd like to lift that limitation, indeed, but keeping the current
> > > general design of how support for sub-processes on MS-Windows is
> > > implemented in Emacs. That's because this design had withstood the
> > > test of time, and so is considered generally solid. I'd like to keep
> > > it that way, with only minimal changes. Do you think this will be
> > > possible?
> >
> > I'll try it and make minimal modifications to the existing code.
>
> Thanks. Please don't hesitate to ask questions, it might save you
> unnecessary work.
>
> In case you didn't know, there's a large comment starting around line
> 890 of the file w32proc.c in the Emacs source tree, which provides an
> overview of how sub-processes are supported in Emacs on MS-Windows.
Please tell me how unexpected errors are generally handled in Emacs. I
need to add checks in my code for certain calls that shouldn't fail,
such as creating threads or events.
> > > Starting from the code of the person who submitted bug#71628 is
> > > possible, but that person will still need to sign the copyright
> > > assignment, as he will be one of the authors of the code. Is that
> > > possible?
> >
> > I will notify him and ask him to reply to this list.
> >
> > Of course, if he disagrees (which is almost impossible), I will
> > consider implementing it myself without relying on his code :p
> Thanks. In that case, it is best if someone else reads his code and
> describes the main ideas, and you then write the code based on that
> description.
He told me that he found the FSF's reply in the spam folder of his
email, so I believe he will submit the signed document soon.
Regards.