delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/30/10:27:02

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,TW_YG,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4C7BBFA1.1020506@sidefx.com>
Date: Mon, 30 Aug 2010 10:26:41 -0400
From: Edward Lam <edward AT sidefx DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0b5pre) Gecko/20100820 Shredder/3.2a1pre
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Uninitialized variable usage in cygthread?
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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?

Thanks,
-Edward

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019