[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
execute, spawn-pipe: Make multithread-safe on native Windows
From: |
Bruno Haible |
Subject: |
execute, spawn-pipe: Make multithread-safe on native Windows |
Date: |
Mon, 30 Nov 2020 18:03:07 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; ) |
So far, the modules 'execute' and 'spawn-pipe' use, on native Windows,
the MSVCRT function _spawnvpe. But this function requires temporary
assignments to the stdin, stdout, or stderr file descriptors, which is
of course not multithread-safe.
With this patch, the modules use 'CreateProcess' directly. The new code
is multithread-safe.
2020-11-30 Bruno Haible <bruno@clisp.org>
execute, spawn-pipe: Make multithread-safe on native Windows.
* lib/windows-spawn.h: Include <stdint.h>, <windows.h>.
(dup_safer_noinherit, undup_safer_noinherit): Remove declarations.
(spawnpvech): New declaration.
* lib/windows-spawn.c: Include <stdio.h>, <process.h>, findprog.h.
Don't include <unistd.h>, cloexec.h, error.h, gettext.h.
(_): Remove macro.
(dup_noinherit, fd_safer_noinherit, dup_safer_noinherit,
undup_safer_noinherit): Remove functions.
(spawnpvech): New function.
* modules/windows-spawn (Depends-on): Add findprog-in, stdint. Remove
cloexec, dup2, error, gettext-h.
* lib/execute.c: Include msvc-nothrow.h.
(execute) [WIN32]: Use _get_osfhandle, spawnpvech instead of _spawnvpe.
* lib/spawn-pipe.c: Include msvc-nothrow.h.
(create_pipe) [WIN32]: Use _get_osfhandle, DuplicateHandle, spawnpvech
instead of _spawnvpe.
* modules/execute (Depends-on): Add msvc-nothrow.
* modules/spawn-pipe (Depends-on): Likewise.
2020-11-30 Bruno Haible <bruno@clisp.org>
execute, spawn-pipe: Improve documentation.
* lib/execute.h: Describe progname, prog_path, prog_argv.
* lib/spawn-pipe.h: Likewise.
0001-execute-spawn-pipe-Improve-documentation.patch
Description: Text Data
0002-execute-spawn-pipe-Make-multithread-safe-on-native-W.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- execute, spawn-pipe: Make multithread-safe on native Windows,
Bruno Haible <=