473,586 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asynch delegates - when is the WaitHandle signalled ?


I am looking at using delegates to perform an asynchronous call.
There will be a callback invoked at the end of the call.
The client thread will wait on the WaitHandle from IAsyncResult (which is
really a AsyncResult).

My question is, when exactly is this WaitHandle signalled - is it:

-when the asynchronous call finishes
OR
-when EndInvoke() is called (by the callback)

I need to know this, to synchronise the client thread and asynch thread.
This is so the asynch thread knows whether the client thread has timed out.

Is the behaviour the same on all versions of .NET ? (the documentation is
unclear, so it could implemented either way ?)

Thanks,

Sean

Oct 23 '06 #1
1 2635
Sean,

It is signaled when the delegate completes.

Brian

Sean wrote:
I am looking at using delegates to perform an asynchronous call.
There will be a callback invoked at the end of the call.
The client thread will wait on the WaitHandle from IAsyncResult (which is
really a AsyncResult).

My question is, when exactly is this WaitHandle signalled - is it:

-when the asynchronous call finishes
OR
-when EndInvoke() is called (by the callback)

I need to know this, to synchronise the client thread and asynch thread.
This is so the asynch thread knows whether the client thread has timed out.

Is the behaviour the same on all versions of .NET ? (the documentation is
unclear, so it could implemented either way ?)

Thanks,

Sean
Oct 23 '06 #2

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

Similar topics

8
2182
by: axxegfx | last post by:
newbie delegates question i'm using this code: sub empezar() Dim del As MyDelSub Dim del2 As MyDelSub Dim delAll As del = New MyDelSub(AddressOf hilo1) del2 = New MyDelSub(AddressOf hilo2)
3
3504
by: Pietje de kort | last post by:
Hello all, I want to implement Timeout behaviour in a class of mine. When a method is called it should timeout after a few seconds. To do this I've built a System.Threading.Timer that calls a delegate method after x milli's, the called delegate throws an exception indicating timeout. The big problem is my code will not catch the thrown...
1
2810
by: | last post by:
Is there any way to find out: 1. which thread is holding a monitor object? 2. how many Monitor.Enter() has been called on an object? 3. which WaitHandle is signaled after WaitHandle.WaitAny()? Thanks.
3
4502
by: Oscar Thornell | last post by:
Hi, I am thinking about doing all my logging asynchronously using a delegate. The main resaon for this would be performance and responsiveness of the application (an ASP.NET app). //Exampel delegate void LogDelegate(string message); LogDelegate logger = new LogDelegate(Log.Debug); logger.DynamicInvoke("Some message..");
1
1241
by: Tobias Matzat | last post by:
Hi! Is it possible to wait for the callback method to finish? When using a WaitHandle only the call of EndInvoke is awaited. I would like to do some calculations in the callback-method. But I don't know how to inform the main thread that the calculations are done, besides defining an event. Is it not possible to let the callback method do...
3
2003
by: Glen | last post by:
This is my first attempt as asynchronous processing. I have created a small test app as proof of concept, but I am having one proglem. In the example (code listed below), my callback routine has two problems: 1. It runs TWICE; and 2. While it seems to update the web page controls, the results never show up on the page. I am using...
11
1755
by: Glen Wolinsky | last post by:
This is my first attempt as asynchronous processing. I have created a small test app as proof of concept, but I am having one proglem. In the example (code listed below), my callback routine has two problems: 1. It runs TWICE; and 2. While it seems to update the web page controls, the results never show up on the page. I am using...
2
1534
by: ghost | last post by:
As the Subject indicates I have written a web page that makes use of several web service calls. Some of the web service calls are very fast so they called synchronously. Some web service calls are longer running so I call them asynch so that they can all run concurrently. The user base for the application that I am creating demands the...
0
1362
by: Patino | last post by:
I have a particular WS consumer application (Windows app) that was not able to read an error from the WS app because it was calling a method asynch. The client app just hangs there. But once I switched the call to a synch, the client app got the error message and displayed it nicely to the user. In this client app. the user does not have to...
0
7841
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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 we have to send another system
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.