471,337 Members | 867 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Thread won't start in a com-interop .net dll called from a VC++ ap

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");
}

Aug 18 '05 #1
0 957

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Doug Kent | last post: by
10 posts views Thread by Michael | last post: by
8 posts views Thread by Jason Chu | last post: by
5 posts views Thread by taylorjonl | last post: by
3 posts views Thread by Joe Befumo | last post: by
3 posts views Thread by =?Utf-8?B?SlQ=?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.