From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Implement open-process and related functions on MinGW Date: Sat, 22 Feb 2014 23:40:20 -0500 Message-ID: <87fvnajvbf.fsf@yeeloong.lan> References: <834n3x8o7m.fsf@gnu.org> <83y519788a.fsf@gnu.org> <871tz0d5vc.fsf@gnu.org> <83iosc76kz.fsf@gnu.org> <87vbwc72dp.fsf_-_@gnu.org> <8361o74e0k.fsf@gnu.org> <87zjljjg7r.fsf@yeeloong.lan> <83eh2v2em9.fsf@gnu.org> <87mwhikdqc.fsf@yeeloong.lan> <8361o63329.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1393130463 11800 80.91.229.3 (23 Feb 2014 04:41:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Feb 2014 04:41:03 +0000 (UTC) Cc: ludo@gnu.org, guile-devel@gnu.org To: Eli Zaretskii Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Feb 23 05:41:10 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WHQsG-0002ux-C9 for guile-devel@m.gmane.org; Sun, 23 Feb 2014 05:41:08 +0100 Original-Received: from localhost ([::1]:51751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHQsF-0008Qp-R7 for guile-devel@m.gmane.org; Sat, 22 Feb 2014 23:41:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHQs7-0008Qa-9d for guile-devel@gnu.org; Sat, 22 Feb 2014 23:41:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHQrz-00021H-4E for guile-devel@gnu.org; Sat, 22 Feb 2014 23:40:59 -0500 Original-Received: from world.peace.net ([96.39.62.75]:49362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHQry-00021D-T4; Sat, 22 Feb 2014 23:40:51 -0500 Original-Received: from ip72-221-68-65.ri.ri.cox.net ([72.221.68.65] helo=yeeloong.lan) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1WHQrb-000219-Ro; Sat, 22 Feb 2014 23:40:28 -0500 In-Reply-To: <8361o63329.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 23 Feb 2014 05:45:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16922 Archived-At: Eli Zaretskii writes: >> From: Mark H Weaver >> Cc: ludo@gnu.org, guile-devel@gnu.org >> Date: Sat, 22 Feb 2014 17:02:35 -0500 >>=20 >> Eli Zaretskii writes: >>=20 >> >> From: Mark H Weaver >> >> Cc: ludo@gnu.org (Ludovic Court=C3=A8s), guile-devel@gnu.org >> >> Date: Sat, 22 Feb 2014 10:54:16 -0500 >> >>=20 >> >> Thanks for working on this, but in a multithreaded program, it's no g= ood >> >> to change the file descriptors in the main program temporarily before >> >> spawning, and then restore them afterwards. We'll have to find anoth= er >> >> 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? >>=20 >> It's safe to fork a multithreaded program without using pthread_atfork >> if only async-signal-safe functions are called before the exec. > > You may know what your code does between fork and exec, but you don't > know what other parts do, like pthreads or the application that called > Guile as a library. I'm not sure I understand what you mean here. The relevant code here is between line 1366 (/* The child. */) and the call to execvp on line 1408. I see calls to 'close', 'open', 'dup', and 'dup2'. How could "pthreads" or "the application that called Guile" cause anything else to happen between fork and exec in the new single-thread child process? Mark