From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 7 16:32:36 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40A2A1065681 for ; Fri, 7 Mar 2008 16:32:36 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id DF5068FC14 for ; Fri, 7 Mar 2008 16:32:35 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.2/8.14.2/NETPLEX) with ESMTP id m27G8otF013328; Fri, 7 Mar 2008 11:08:50 -0500 (EST) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Fri, 07 Mar 2008 11:08:51 -0500 (EST) Date: Fri, 7 Mar 2008 11:08:50 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: "Marko, Shaun" In-Reply-To: <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com> Message-ID: References: <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-ID: Cc: FreeBSD Hackers Subject: Re: libpthread/fork issue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2008 16:32:36 -0000 On Thu, 6 Mar 2008, Marko, Shaun wrote: > I'm working on FreeBSD 6.2 and I'm wondering if anybody can help with an > issue I've found using fork and threads. The attached program > demonstrates the problem. In short, if a process creates a thread, joins > the thread, then forks a child process which creates a thread, the > child's attempt to create a thread will cause the program to dump core > with the following error message: > Fatal error 'mutex is on list' at line 540 in file > /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0). You are not allowed by POSIX to call any non-async-signal-safe function from a child of a threaded program. There's words or rationale to the effect that the only purpose for forking from a threaded program should be to call one of the exec* functions. Trying to create a thread from a child (like you are trying to do) is definitely not supported. -- DE