473,322 Members | 1,241 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,322 software developers and data experts.

asynchonous callbacks

What is the best way to return to the calling code when calling a
asynchronous i/o call in C#. I have in other situations written
systems that were totally event driven so the callback fires an event.
My initial C# attempt has involved the callback re-calling the
origination function with a parameter object representing the modified
state i.e. call success and the next operation to perform. However I
am not sure what this is doing to the call-stack.
Is the method I am using correct?
Should I fire an event in the callback, delegated to calling function.
Should I block the calling function using a synchronising mechanism?
(How?)
Nov 15 '05 #1
2 1368
If you must "return to the calling code", then your last option (blocking
when your result is required) is probably the best. (I'm kind of guessing
here, since I don't really know for sure what you're trying to accomplish)

To do this look at Asynchronous Delegates and usage of the
AsyncResult/IAsyncResult types. You can start your long process, continue to
do operations, then when you need the result you can block until it is ready
(if it isn't already there).

http://msdn.microsoft.com/library/de...sdelegates.asp

"Paul" <pa*********@shinyorb.com> wrote in message
news:8d**************************@posting.google.c om...
What is the best way to return to the calling code when calling a
asynchronous i/o call in C#. I have in other situations written
systems that were totally event driven so the callback fires an event.
My initial C# attempt has involved the callback re-calling the
origination function with a parameter object representing the modified
state i.e. call success and the next operation to perform. However I
am not sure what this is doing to the call-stack.
Is the method I am using correct?
Should I fire an event in the callback, delegated to calling function.
Should I block the calling function using a synchronising mechanism?
(How?)

Nov 15 '05 #2
Philip Rieck,
many thanks for the pointer, I now have sensible code.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

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

Similar topics

1
by: Melissa Wallis | last post by:
I have a class with 5 callbacks. Two of the callbacks work fine but the others don't. The main difference is that the callbacks that don't work are composed of a sequence of structs. I noticed a...
0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
5
by: Christopher Jastram | last post by:
I'm a self-taught programmer, so this might be a pretty dumb question. If it is, please point me in the right direction and I shall apologize profusely. I have a question regarding C++ and...
1
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.