Chirs' suggestion 1 should be used carefully as it might still
block the process from exit, if there's a blocking call into
native code going on.
In your particular case where you're listening to data on a port,
I'd recommend Close/Dispose the socket from your main thread,
which will give an ObjectDisposedException in the background
thread that you should handle gracefully.
"<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message news:O3**************@TK2MSFTNGP05.phx.gbl...
1. Make it a Background thread (set the IsBackground proeprty)
2. Use timeouts in your wait that periodically come back to see if it should end
3. Wait on multiple items, like data receive and a quit event
-Chris
"Ole" <ol*@blabla.com> wrote in message news:Oo**************@TK2MSFTNGP04.phx.gbl... CF2.0
VS2005
C#
How to stop a worker thread that is e.g. listening for data on a port when the application is closed?
Thanks,
Ole