473,471 Members | 2,533 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Aborting async execution started by BeginInvoke?


When the BeginInvoke method of a delegate is called, the
execution of the delegate is in another thread. (I'm not
sure if an entirely new thread is created, or if a "sleeping"
thread is used.)

Now, is there any way to stop this execution?

Suppose there are some really heavy calculations (or whatever)
that needs to be performed every time indata change. Assume
it takes somewhere around 10-60 seconds to do these calculations.

An obvious way to implement this is to call the BeginInvoke of
a delegate (in which all the work is done) and get a call to a
callback when the calculations are finished. (So you e.g. don't
lock the GUI and network communications for the 10-60 seconds.)

However, let's say indata can change before the calculations are
finished, and then you want to stop the first "calculation batch"
and start a second with this new indata.

Is this possible to do? The IAsyncResult returned by BeginInvoke
doesn't seem to have any "Abort" method, but is it possible to
derive the corresponding Thread from the IAsyncResult, and call
the Abort method of this Thread? (Or would such a technique mess
things up, e.g. perhaps kill all the outstanding current and
subsequent executions of calls to BeginInvoke?)

/Gomaw

Nov 15 '05 #1
1 3122
Metxtli
1 New Member
Hi,

I have the same question, there are any solution??

regards,

Metxtli
Apr 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Dave | last post by:
I'm using the BeginInvoke method of a delegate to invoke a thread asynchronously and then use the EndInvoke to retrieve the value. This works wonderfully until a Serviced Component is added to...
4
by: Vlad | last post by:
I have implemented an asyncrhonous execution of a method using the delegate's BeginInvoke() I am trying to spin multiple worker threads in a thread pool. Here is the code: TestProcess process =...
10
by: Shawn Meyer | last post by:
Hello - I am trying to write a class that has an async BeginX and EndX, plus the regular X syncronous method. Delegates seemed like the way to go, however, I still am having problems getting...
1
by: eminemabcd | last post by:
Hi, I encountered a problem trying to write a code that does the following: 1. Main GUI thread invokes a delegate using BeginInvoke. 2. A secondery thread (from the application's managed thread...
4
by: Dennis Sjogren | last post by:
Greetings! First, I'm not 100% sure where to post this question. I use VB.NET for this project, but it's really a design question (a question on which method to use when solving this problem). ...
1
by: jonathan | last post by:
I need to create a webpage that asynchronously loads a series of user controls onto a page. If the user control take longer than X seconds to load it should display an error message in it place....
7
by: archana | last post by:
Hi all, I am having application in which i am doing asynchronous call.I am using manualresetevent to wait for asynchronous call to complete. I want to stop asynchronous call after certain...
9
by: BartMan | last post by:
Greetings, I am trying to fire aysnc events in c++/clr, and I can't seem to get it to work. It seems to work fine in c#, but when I try c++/clr, I can't seem to get it to compile in the c++/clr...
12
by: Tomaz Koritnik | last post by:
Is it possible to asynchronously call a method from worker thread so that this method would execute in main-thread? I'm doing some work in worker thread and would like to report progress to main...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.