DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 30 Jul 2007 19:29:17 +0530,    posted on: microsoft.public.dotnet.framework.compactframework        back       

Thread Index
  1    Hitesh Ashar
          2    Paul G. Tobey [eMVP] p space tobey no spam AT no instrument no spam DOT com
                 3    Hitesh Ashar
                        4    Paul G. Tobey [eMVP] p space tobey no spam AT no instrument no spam DOT com
                 5    Hitesh Ashar


Interrupt a thread   
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
hitesh (at) asharism (dot) com
Date:Mon, 30 Jul 2007 19:29:17 +0530   Author:  

Re: Interrupt a thread   
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.

"Hitesh Ashar"  wrote in message 
news:46ADEEB5.2040409@asharism.com...

> 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
> hitesh (at) asharism (dot) com 
Date:Mon, 30 Jul 2007 08:45:23 -0700   Author:  

Re: Interrupt a thread   
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

Paul G. Tobey [eMVP] wrote:

> 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.
> 


-- 
Hitesh Ashar
hitesh (at) asharism (dot) com
Date:Tue, 31 Jul 2007 13:49:45 +0530   Author:  

Re: Interrupt a thread   
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.

"Hitesh Ashar"  wrote in message 
news:46AEF0A1.2000408@asharism.com...

> 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
>
> Paul G. Tobey [eMVP] wrote:
>> 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.
>>
>
> -- 
> Hitesh Ashar
> hitesh (at) asharism (dot) com 
Date:Tue, 31 Jul 2007 08:25:29 -0700   Author:  

Re: Interrupt a thread   
Many thanks for your help Paul.

-- 
Hitesh Ashar
hitesh (at) asharism (dot) com
Date:Wed, 01 Aug 2007 15:23:44 +0530   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us