Thread.Abort() - how in CF?

  • Thread starter Thread starter Yechezkal Gutfreund
  • Start date Start date
Y

Yechezkal Gutfreund

Since the CF does not support Thread.CurrentThread.Abort()
how does one stop the current thread.

Assume the thread was started by wrapping a delagate around a method and
calling
threadStart:
Thread theListener = new Thread(new ThreadStart(KTGInc.FlashComm.Accept));

theListener.Start();
 
By setting up an event or a shared flag variable (must be use with
lock/unlock)
 
Hi,

Typically an application will set a global variable when it is ready to shut
down, the worker thread will see that global and exit while the main thread
waits for the worker to stop before closing. Here is a sample for a HOWTO
that is currently being published:

http://download.microsoft.com/downl...c-b6bc-0c1dd962f7b7/StopThreadSampleSetup.exe

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.
 
My question is even more basic. I am in the worker thread. I have seen the
event (or semaphore switch).
Now how does this worker thread indicate it is doing an "exit"?

Is it as simple as returning from the method call? i.e return? or simply
falling off
the end of the method (implied return from method invokation].

[I am an old time OS person, I have images
of a non-existant return address on the stack of the thread, which when you
return, will cause
the program counter to point to some random address]
 
Yes, return is sufficient.

Yechezkal Gutfreund said:
My question is even more basic. I am in the worker thread. I have seen the
event (or semaphore switch).
Now how does this worker thread indicate it is doing an "exit"?

Is it as simple as returning from the method call? i.e return? or simply
falling off
the end of the method (implied return from method invokation].

[I am an old time OS person, I have images
of a non-existant return address on the stack of the thread, which when you
return, will cause
the program counter to point to some random address]



Geoff Schwab said:
Hi,

Typically an application will set a global variable when it is ready to shut
down, the worker thread will see that global and exit while the main thread
waits for the worker to stop before closing. Here is a sample for a HOWTO
that is currently being published:
http://download.microsoft.com/downl...c-b6bc-0c1dd962f7b7/StopThreadSampleSetup.exe
--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top