mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-27 06:51:44 -08:00
run-program: remove redundant finalizer for windows handles
We have already registered a finalizer for the external process object which calls external-process-wait. This in turn calls si::waitpid which closes the handle once the process has exited.
This commit is contained in:
parent
ddb7bb72e9
commit
0638932696
4 changed files with 3 additions and 12 deletions
|
|
@ -2069,7 +2069,6 @@ cl_symbols[] = {
|
|||
#endif
|
||||
{SYS_ "RUN-PROGRAM-INNER" ECL_FUN("si_run_program_inner", si_run_program_inner, 4) ECL_VAR(SI_ORDINARY, OBJNULL)},
|
||||
{SYS_ "SPAWN-SUBPROCESS" ECL_FUN("si_spawn_subprocess", si_spawn_subprocess, 6) ECL_VAR(SI_ORDINARY, OBJNULL)},
|
||||
{SYS_ "CLOSE-WINDOWS-HANDLE" ECL_FUN("si_close_windows_handle", IF_WINDOWS(si_close_windows_handle), 1) ECL_VAR(SI_ORDINARY, OBJNULL)},
|
||||
/* ~ */
|
||||
|
||||
{EXT_ "*INVOKE-DEBUGGER-HOOK*" ECL_FUN(NULL, NULL, -1) ECL_VAR(EXT_SPECIAL, ECL_NIL)},
|
||||
|
|
|
|||
|
|
@ -214,15 +214,6 @@ si_killpid(cl_object pid, cl_object signal) {
|
|||
#endif
|
||||
|
||||
#if defined(ECL_MS_WINDOWS_HOST)
|
||||
cl_object
|
||||
si_close_windows_handle(cl_object h)
|
||||
{
|
||||
if (ecl_t_of(h) == t_foreign) {
|
||||
HANDLE *ph = (HANDLE*)h->foreign.data;
|
||||
if (ph) CloseHandle(*ph);
|
||||
}
|
||||
}
|
||||
|
||||
static cl_object
|
||||
make_windows_handle(HANDLE h)
|
||||
{
|
||||
|
|
@ -230,7 +221,6 @@ make_windows_handle(HANDLE h)
|
|||
sizeof(HANDLE*));
|
||||
HANDLE *ph = (HANDLE*)foreign->foreign.data;
|
||||
*ph = h;
|
||||
si_set_finalizer(foreign, @'si::close-windows-handle');
|
||||
return foreign;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1954,7 +1954,6 @@ extern ECL_API void ecl_check_pending_interrupts(cl_env_ptr env);
|
|||
extern ECL_API cl_object si_system(cl_object cmd);
|
||||
extern ECL_API cl_object si_make_pipe();
|
||||
extern ECL_API cl_object si_run_program _ECL_ARGS((cl_narg narg, cl_object command, cl_object args, ...));
|
||||
extern ECL_API cl_object si_close_windows_handle(cl_object h);
|
||||
extern ECL_API cl_object si_terminate_process _ECL_ARGS((cl_narg narg, cl_object process, ...));
|
||||
extern ECL_API cl_object si_waitpid(cl_object pid, cl_object wait);
|
||||
extern ECL_API cl_object si_killpid(cl_object pid, cl_object signal);
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@
|
|||
;;; We don't handle `sigchld' because we don't want races with
|
||||
;;; `external-process-wait'. Take care of forgotten processes.
|
||||
(defun finalize-external-process (process)
|
||||
;; INV: this finalizer also closes the process handle on windows
|
||||
;; since external-process-wait calls si:waitpid which closes the
|
||||
;; handle once the process has exited.
|
||||
(unless (member (ext:external-process-wait process nil)
|
||||
'(:exited :signaled :abort :error))
|
||||
(ext:set-finalizer process #'finalize-external-process)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue