all groups > dotnet compact framework > july 2007 >
You're in the

dotnet compact framework

group:

Interrupt a thread


Re: Interrupt a thread Paul G. Tobey [eMVP]
7/30/2007 8:45:23 AM
dotnet compact framework:
Interrupt it for what purpose? Generally, if you're just planning to exit a
thread, you need to write your code in such a way that conventional
interthread communication methods are used to notify the thread that it's
time to exit. For example, if the thread is managing communications with a
Socket and you want to exit the thread, you'd set an 'exit' flag and close
the socket from your controller thread. The thread would get some sort of
an exception because the socket was closed out from under it, it would then
check the exit flag and clean itself up.

Paul T.

[quoted text, click to view]

Interrupt a thread Hitesh Ashar
7/30/2007 7:29:17 PM
I'm working with a CF project and I need to interrupt a thread.

Thread.Interrupt() is not supported in CF. Would anyone know if there
are any alternatives to do the same?

TIA
--
Hitesh Ashar
Re: Interrupt a thread Hitesh Ashar
7/31/2007 12:00:00 AM
Thanks Paul. I understand what you are saying.

However, I'm trying to migrate a full .NET library to CF and I am to
avoid any changes to the behavior of the code. The CF does have limited
overloads, however, there are several workarounds and I was wondering if
there was one to Thread.Interrupt.

BR,
Hitesh

[quoted text, click to view]

--
Hitesh Ashar
Re: Interrupt a thread Paul G. Tobey [eMVP]
7/31/2007 8:25:29 AM
No. In fact, there's no way to implement it without some knowledge of what
it's blocking on, so I think you're out of luck.

Paul T.

[quoted text, click to view]

Re: Interrupt a thread Hitesh Ashar
8/1/2007 12:00:00 AM
Many thanks for your help Paul.

--
Hitesh Ashar
AddThis Social Bookmark Button