This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Uninitialized variable usage in cygthread?


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, if dynamically_loaded is true, then we call sigproc_init().

- In, 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::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?


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]