From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3369 invoked by alias); 9 Jul 2008 07:55:59 -0000 Received: (qmail 3355 invoked by uid 22791); 9 Jul 2008 07:55:57 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jul 2008 07:55:40 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id m69701Ov002591; Wed, 9 Jul 2008 09:00:01 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id m69700TT013047; Wed, 9 Jul 2008 09:00:00 +0200 (CEST) Date: Wed, 09 Jul 2008 07:55:00 -0000 Message-Id: <200807090700.m69700TT013047@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: msnyder@specifix.com CC: drow@false.org, pedro@codesourcery.com, gdb-patches@sourceware.org In-reply-to: <1215575706.3549.140.camel@localhost.localdomain> (message from Michael Snyder on Tue, 08 Jul 2008 20:55:06 -0700) Subject: Re: [non-stop] 08/10 linux native support References: <200806152205.49241.pedro@codesourcery.com> <200806252217.25796.pedro@codesourcery.com> <20080625221220.GB5723@caradoc.them.org> <200807020434.50543.pedro@codesourcery.com> <20080707182009.GE1778@caradoc.them.org> <1215573936.3549.126.camel@localhost.localdomain> <20080709034706.GA21192@caradoc.them.org> <1215575706.3549.140.camel@localhost.localdomain> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00126.txt.bz2 > From: Michael Snyder > Date: Tue, 08 Jul 2008 20:55:06 -0700 > > Here's IEEE std 1003.1: > > A process shall be created with a single thread. 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. [THR] [Option Start] > Fork handlers may be established by means of the pthread_atfork() > function in order to maintain application invariants across fork() > calls. [Option End] > > > The issue is that only the thread that actually calls fork() > will be duplicated in the child, but the mutexes (which may have > been held by another thread) will be duplicated, and therefore > the child may deadlock. And I'd argue that this is a direct logical consequence of the fact that fork() behaviour is pretty well defined by POSIX.