X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Mon, 30 Aug 2010 16:45:44 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Uninitialized variable usage in cygthread?
Message-ID: <20100830144544.GO6726@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <4C7BBFA1.1020506@sidefx.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <4C7BBFA1.1020506@sidefx.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Aug 30 10:26, Edward Lam wrote:
> Hi,
> 
> In looking at slowdown problem on x64 systems by Sagi Ben-Akiva, I
> found some puzzling code that perhaps someone could enlighten me on.
> I must be reading it wrong.
> 
> Here's the code path that I'm tracing using cygwin-src-20100829.tar.bz2:
> 
> - In dcrt0.cc, if dynamically_loaded is true, then we call sigproc_init().
> 
> - In sigproc.cc, sigproc_init() creates a new thread:
>   hwait_sig = new cygthread (wait_sig, 0, cygself, "sig");
> 
> - This calls the cygthread constructor for LPTHREAD_START_ROUTINE.
> (Actually, this doesn't really matter because the constructor for
> LPVOID_START_ROUTINE looks like it has the same problem.)
> 
> - The cygthread constructor calls create(). But prior to this, the
> following class members are initialized:
> __name, func, arglen, arg, notify_detached
> 
> - The following class members are NOT initialized (assuming that the
> macro DEBUGGING is NOT set):
> inuse, id, h, ev, thread_sync, stack_ptr, is_freerange
> 
> - Ok, now the cygthread constructor calls cygthread::create()
> 
> - In cygthread.cc, cygthread::create() immediately checks the value
> of the variable "h". But as mentioned previously, this is a variable
> that has not been initialized yet.
> 
> 
> What am I missing?

cygthread::operator new(size_t)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

