Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 2nd, 2007, 10:24 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default abort Asynchron?

GetAsyncCallbackDelegate delg = new GetAsyncCallbackDelegate(MyMethod);
                IAsyncResult result = delg.BeginInvoke(x, true, new AsyncCallback(GetOnAsyncCallComplete), delg); // Invokes the method asynchronously. An AsyncCallback delegate that references the method to invoke when the read operation is complete.


how can i abort this Asynchron thread.


 
Old May 3rd, 2007, 07:07 AM
Authorized User
 
Join Date: Dec 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DZukiewicz
Default

As far as I know, you cannot abort it. Being asynchronous, you have to called the EndInvoke() in order to view exceptions raised.

The alternative is to throw an exception, within your async method, stop the thread processing (by doing any tidy up) and then throw the exception again so that your code outside can see it.

Regards,

Dominic





Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Practice: Thread Management: Making Asynchron dmagliola ASP.NET 2.0 Professional 1 May 27th, 2008 09:12 AM
Problem with Thread.abort nelly78 .NET Framework 2.0 10 April 4th, 2008 01:12 AM
Abort thread when regular expression get stuck? gurupak C# 2005 0 March 20th, 2007 02:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.