[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Implement open-process and related functions on MinGW
From: |
Mark H Weaver |
Subject: |
Re: [PATCH] Implement open-process and related functions on MinGW |
Date: |
Sat, 22 Feb 2014 17:02:35 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
>> From: Mark H Weaver <address@hidden>
>> Cc: address@hidden (Ludovic Courtès), address@hidden
>> Date: Sat, 22 Feb 2014 10:54:16 -0500
>>
>> Thanks for working on this, but in a multithreaded program, it's no good
>> to change the file descriptors in the main program temporarily before
>> spawning, and then restore them afterwards. We'll have to find another
>> way of doing this.
>
> Btw, how does the Posix build work reliably when it forks after
> several threads are already running? I don't see any calls to
> pthread_atfork or any similar machinery in place. What am I missing?
It's safe to fork a multithreaded program without using pthread_atfork
if only async-signal-safe functions are called before the exec. In
fact, that's why Andy rewrote 'open-process' in C, as it says in the
comment above that function.
"If a multi-threaded process calls fork(), the new process shall
contain a replica of the calling thread and its entire address space,
possibly including the states of mutexes and other resources.
Consequently, to avoid errors, the child process may only execute
async-signal-safe operations until such time as one of the exec
functions is called."
http://pubs.opengroup.org/onlinepubs/000095399/functions/fork.html
Mark
- Re: [PATCH] Implement open-process and related functions on MinGW, (continued)
- Re: [PATCH] Implement open-process and related functions on MinGW, Mark H Weaver, 2014/02/23
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/23
- Re: [PATCH] Implement open-process and related functions on MinGW, Mark H Weaver, 2014/02/24
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/24
- Re: [PATCH] Implement open-process and related functions on MinGW, Mark H Weaver, 2014/02/28
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/28
- Re: [PATCH] Implement open-process and related functions on MinGW, Mark H Weaver, 2014/02/28
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/28
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/24
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/22
- Re: [PATCH] Implement open-process and related functions on MinGW,
Mark H Weaver <=
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/22
- Re: [PATCH] Implement open-process and related functions on MinGW, Mark H Weaver, 2014/02/22
- Re: [PATCH] Implement open-process and related functions on MinGW, Eli Zaretskii, 2014/02/23
- Re: [PATCH] Implement open-process and related functions on MinGW, Mark H Weaver, 2014/02/23
- Re: MinGW patches, Eli Zaretskii, 2014/02/22
- Re: MinGW patches, Neil Jerram, 2014/02/22
- Re: MinGW patches, Eli Zaretskii, 2014/02/22
- Re: MinGW patches, Eli Zaretskii, 2014/02/22
- Re: MinGW patches, Mark H Weaver, 2014/02/22
- Re: MinGW patches, Eli Zaretskii, 2014/02/22