terminate-process: add information about potential race

This commit is contained in:
Daniel Kochmański 2017-02-20 16:20:29 +01:00
parent 6733369ea0
commit 663b1bdcf2

View file

@ -76,6 +76,13 @@
(values (external-process-%status process)
(external-process-%code process)))
;;; This function isn't overly safe. Assuming `external-process-wait'
;;; is called after getting PID bu before function sends signal,
;;; zombie may be already removed and we are shooting the
;;; air. Reasonable expectation here would be putting the burden on
;;; the user, that he can't call both functions in racy manner. We are
;;; protected from sigchld-handler here thanks to the global lock
;;; active processes.
(defun terminate-process (process &optional force)
(with-active-processes-lock
(let ((pid (external-process-pid process)))