I recently replaced my Toshiba 6100 laptop running XP Pro with a Dell
Latitude D810 running XP Pro; since that time an application that I developed
over a year ago has stopped working. I am using the same development
environments, code, and third-party components. Nothing is different except
the development computer. If I use my test app, written in C#, to "drive"
the DLL, the thread starts and the program works flawlessly on the Dell. If
I install this application on a Panasonic laptop running Windows XP, it works
flawlessly. If I install this application on a Toshiba laptop running
Windows 2000; the application works flawlessly. But if I run it on my new
Dell, driven by the VC++ application it simply doesn't start the thread. I
get no warnings and no errors; the thread simply doesn't start. The program
is described below.
In the constructor of the main class in the DLL, I create a few
AutoResetEvents, initialize some data, and create a thread that is supposed
to monitor a serial port. I can create the thread, set the thread priority
and a few other settings, but when I call Start(); the thread simply doesn't
start. I get no warnings or complaints; the thread simply refuses to start.
Here is the code for the constructor.
public Devices()
{
suspend1 = new AutoResetEvent(false);
resume1 = new AutoResetEvent(false);
shutdown1 = new AutoResetEvent(false);
ps_confirm = new AutoResetEvent(false);
events = new AutoResetEvent[6];
for(int i=0;i<6;i++)
events[i] = new AutoResetEvent(false);
readfromtool = false;
chgmode = false;
comport = NONE;
devicemode = NONE;
toolmode = NONE;
showwindow = false;
passQ = new Queue();
dummylist = new ArrayList();
thrd = new Thread(new ThreadStart(Collect));
thrd.Name = "Comm Port Reader";
thrd.Priority = ThreadPriority.Highest;
thrd.IsBackground = true;
bool val = thrd.IsBackground;
thrd.Start();
if (!thrd.IsAlive)
MessageBox.Show("Thread not started");
}