From owner-freebsd-threads@FreeBSD.ORG Fri Aug 29 14:46:16 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 974B6106566C; Fri, 29 Aug 2008 14:46:16 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id 43A078FC18; Fri, 29 Aug 2008 14:46:16 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id C9B87744189; Fri, 29 Aug 2008 17:18:20 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ovAWzFYyU60e; Fri, 29 Aug 2008 17:18:20 +0300 (EEST) Received: from [10.2.1.87] (gateway.cybervisiontech.com.ua [91.198.50.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 2EA8B744172; Fri, 29 Aug 2008 17:18:20 +0300 (EEST) Message-ID: <48B8052A.6070908@icyb.net.ua> Date: Fri, 29 Aug 2008 17:18:18 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.16 (X11/20080805) MIME-Version: 1.0 To: Kostik Belousov References: <48B70A98.5060501@icyb.net.ua> <48B7101E.7060203@icyb.net.ua> <48B71BA6.5040504@icyb.net.ua> <20080829141043.GX2038@deviant.kiev.zoral.com.ua> In-Reply-To: <20080829141043.GX2038@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=KOI8-U Content-Transfer-Encoding: 7bit Cc: davidxu@freebsd.org, freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Aug 2008 14:46:16 -0000 Kostik, thanks! on 29/08/2008 17:10 Kostik Belousov said the following: > I am wondering why did you not fixed it youself with all this information. I am wondering that myself now :-) I got bogged in rtld details and simply didn't think about the solution of doing setthreaded earlier. I will try your patch a couple of hours later. BTW, a forward question - should this patch help in the case of an exception thrown (and caught) before main(), i.e. in constructors of static/global objects? > Anyway, patch below seems to work for me. David may have an opinion on > the change. > > diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c > index f96bba9..785d610 100644 > --- a/lib/libthr/thread/thr_init.c > +++ b/lib/libthr/thread/thr_init.c > @@ -355,6 +355,9 @@ _libpthread_init(struct pthread *curthread) > if (_thread_event_mask & TD_CREATE) > _thr_report_creation(curthread, curthread); > } > + > + if (_thr_isthreaded() == 0) > + _thr_setthreaded(1); > } > > /* -- Andriy Gapon