App not closing, threading...

H

Hilton

Hi,

In CF 1.0, if you create a thread and don't terminate it, the app does not
close. Therefore, you need to ensure that all threads are terminated.
Ideally, you set a flag, the 'run' loop falls through and you're done.
Otherwise you have to get agressive with ThreadEx.Abort (OpenNETCF).

OK, now assume that your app does not quit (kinda randomly). Does this mean
that a thread is still running or that it could be something else? Assuming
that it is a running thread, are there any useful tools or techniques for me
to use to figure out exactly which thread is still running. I set the name
in ThreadEx, but that is local to ThreadEx and therefore won't show up on a
TaskMgr utility.

Here is some interesting information:
1. HelloWorld - just a form created from New, Project in VS2003 has five
threads - all priority 251.
2. I have seen my app not closing and being left with only three threads -
all priority 251.

Is it possible that some system/CF thread isn't being closed?
How can I figure out which thread of mine (assuming it is mine) is still
running?
Could it be a non-thread issue preventing the app from closing?

BTW: The app goes away, looks closed for all intents and purposes, but you
get a sharing violation when trying to delete the EXE. The process also
appears in a process viewer.

Thanks,

Hilton
 
G

Guest

The Toolhelp stuff would let you find and kill it but it's far better to try
and find that rogue thread and shut it down properly. How are you closing
your worker threads? Are they blocked in system calls?


--
Chris Tacke - Embedded MVP
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--
 

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