Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Authentication-Warning: atacama.four-d.de: mail set sender to <tpfaff@gmx.net> using -f
Message-ID: <3EE587F7.9090405@gmx.net>
Date: Tue, 10 Jun 2003 09:25:43 +0200
From: Thomas Pfaff <tpfaff@gmx.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Rasmus Hahn <rassahah@neofonie.de>
CC: cygwin <cygwin@cygwin.com>
Subject: Re: Problem w/ c++,threads,static initializers
References: <20030607142449.A4909@hamburg.neofonie.local>
In-Reply-To: <20030607142449.A4909@hamburg.neofonie.local>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Rasmus Hahn wrote:

> Hello,
> 
> i am using cygwin on my Windows2000 and my c++ program segfaults
> when using pthread-mutexes. In particular i am using a lot of
> mutexes from within constructors of static objects. These constructors
> are called at a very early time of execution of the program and do
> calls of pthread_mutex_init, pthread_mutex_lock and such. Taken a glance
> at the cygwin source i noticed that the static initializers (constructors
> of static objects) are run _before_ some user_data->threadinterface is
> initialized (look at dll_crt0_1 () in winsup/cygwin/dcrt0.cc). Isnt it 
> possible to use thread-functions from static initializers?
> BTW i am using cygwin snapshot 20030602 compiled with gcc-3.3 since the
> out-of-the-box gcc from the cygwin-package is a prerelease and definitely
> contains bugs that do not allow it to compile my code.
> 

Could you provide a test case ?

I have done some tests and my constructors are run from
do_global_ctors if they are in the executable and from
dll_list::init if they are in a dll.
In both cases they are run when the cygwin dll is completely initialized.

Thomas



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

