In what order does Emacs handle simultaneous process sentinels?

In what order does Emacs handle simultaneous process sentinels?

#emacs

Couldn't find this info in the manual.

Answer: The first process that finished is the first one handled.

Verified as follows:

(dotimes (i 10)
  (make-process :name (format "*%d*" i)
                :buffer (get-buffer-create (format "*foo-%d*" i) t)
                :command (list "emacs" "-Q" "--batch"
                               "--eval"
                               (prin1-to-string
                                `(progn
                                   (make-list (random 100)
                                              (make-list (random 100)
                                                         t))
                                   (print
                                    (format "%dth spawned, finished at %.3fs"
                                            ,i (time-to-seconds))))))
                :sentinel (lambda (proc _)
                            (with-current-buffer (process-buffer proc)
                              (message "%s" (buffer-string)))
                            (kill-buffer (process-buffer proc)))))

A result:

"6th spawned, finished at 1730132198.780s"
"2th spawned, finished at 1730132198.778s"
"0th spawned, finished at 1730132198.781s"
"1th spawned, finished at 1730132198.803s"
"3th spawned, finished at 1730132198.822s"
"4th spawned, finished at 1730132198.838s"
"9th spawned, finished at 1730132198.842s"
"5th spawned, finished at 1730132198.850s"
"7th spawned, finished at 1730132198.876s"
"8th spawned, finished at 1730132198.900s"

Related

Emacs async process performance

What links here

  • 2024-10-28
Created (5 weeks ago)