473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cancel an asynchronous method call made to delegate using BeginInv

I would like to cancel a call to BeginInvoke of a delegate (i.e. kill the
thread the call was made on). This would be done when a timeout occures for
the waitone call to the WaitHandle object of the IAsyncResult interface
returned by the BeginInvoke.

I have tried using the Close method of the WaitHandle object to end the call.

While I'm asking, please explain (in more detail than the MSDN Library) what
the bool parameter of the waitOne method does.
--
Jeffrey Kingsley
Xerox Inovation Group
Xerox Corporation
Nov 16 '05 #1
1 3937
Unfortunately you want to do something that can't be done - you cannot cancel the async execution. The WaitHandle sinply lets to time out the wait and so you can stop waiting for the request to finish.

As far as the boolean parameter goes I think its along these lines:

Context bound objects support the concept of causality based synchronization (like COM+). In other words a single call chain (whether cross threads or not) can access a bunch of objects protected by this causality lock, a different call chain (line of execution) cannot while the first has ownership of the lock. I think this flag means that if set to true, the causality lock should be released if the wait times out.

Fundementally, its not going to help you cancel an async method.

The only way of doing this is to use your own thread which you can Interrupt, either as a dedicated thread or as part of a custom threadpool.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<95**********************************@microsoft.co m>

I would like to cancel a call to BeginInvoke of a delegate (i.e. kill the
thread the call was made on). This would be done when a timeout occures for
the waitone call to the WaitHandle object of the IAsyncResult interface
returned by the BeginInvoke.

I have tried using the Close method of the WaitHandle object to end the call.

While I'm asking, please explain (in more detail than the MSDN Library) what
the bool parameter of the waitOne method does.
--
Jeffrey Kingsley
Xerox Inovation Group
Xerox Corporation

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.770 / Virus Database: 517 - Release Date: 27/09/2004

[microsoft.public.dotnet.languages.csharp]
Nov 16 '05 #2

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

Similar topics

2
by: Dayne | last post by:
Does an asychronous thread (.beginInvoke) die when the method call ends? DT
4
by: pz0071 | last post by:
G'day, I think I got my head around using delegates, particularily when updating the user interface from another thread. I got it all sussed, just not 100% sure on the correct syntax for...
3
by: Dave | last post by:
I have a piece of hardware connected via serial port. I need to send a variety of commands to the box and route the responses back from the receive thread to the correct method call. So e.g. I...
0
by: Vicky | last post by:
i have made a web service in .net and a clinet in vb 6. I am accessing web service using soap toolkit. everything is fine. But now i wanted to access the service asynchronously, what should i do to...
3
by: Bruce Wood | last post by:
Maybe I'm going nuts, but I was so sure that adding the same method more than once to a delegate would result in only one entry on the delegate's call list: this.UpdateEnd += new...
0
by: Raymondr | last post by:
Hi, First a brief description of out application: We have a webapplication which calls a couple of webservices during one request (postback). These calls to the webservices are made concurrent...
4
by: Dachshund Digital | last post by:
Why does Join method call sit there forever? This code works, including the delegate call, but if the join method is ever called, it seems the main thread blocks, and it is hung. HELP! This is...
1
by: Morgan Cheng | last post by:
Asynchronous method model generally has a callback delegate as argument. The delegate will be called when some WaitHandle is set or time out. And, one more argument is used as state object to...
7
by: Peter Laan | last post by:
Is there a simple way to encapsulate the functionality to redo a method call a second time in case a specific exception is thrown? We are sending commands to an external system and if the sessionId...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.