Loose Threads

M

Michael C

Thank you all for all your help. My projects are chugging along now. I
have one more quick question, if you don't mind. I'm calling the WTS API
function WTSSessionEnumerate() multiple times on multiple worker threads
using asynchronous delegates and callbacks. Everything seems to work fine,
and I get the correct results returned. The problem is that every time I
stop the program, VS.NET tells me that between 3 and 10 of the worker
threads have not shut down? I call BeginInvoke() and EndInvoke(), and as I
said all the returned results are accurate. The worker threads don't appear
to be doing anything in the background, other than waiting to be shut down,
but this worker thing has me a little worried about possible future problems
when I run the app on other computers.

By the way, when I close the program, or if I hit a "Refresh" button that
restarts the asynchronous processing from scratch, VS.NET tells me again
that around 3 - 10 worker threads are shutting down. How do I force the
worker threads to shut down when I know they are completed processing? Is
there a function I can use to kill ALL worker threads I've started, to
ensure they all shut down properly?

Thanks again,
Michael C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top