Link to home
Start Free TrialLog in
Avatar of lordiano
lordiano

asked on

Async Calls Problem

Hi guys, I have a problem with Async call and below is the logic of my code

Function A
{
Make array of size 2 of WaitHandle
Make 2 AsyncCallback
Make 2 delegate
Make 2 IAsyncResult from the 2 delegate with BeingInvoke by passing the AsyncCallback as first parameter and null as second
Insert the IAsyncResult to WaitHandle[0] and WaitHandle[1]
WaitHandle.WaitAll(WaitHandleIMade)
}

CallBackFunction1
{
Make arrya of size 2 of Waithandle
Make 2 delegate
Make 2 IAsyncResult from the 2 delegate with BeingInvoke
Insert the IAsyncResult to WaitHandle[0] and WaitHandle[1]
WaitHandle.WaitAll(WaitHandleIMade)
}

CallBackFunction2
{
Synchronous process some stuffs
}

The question i have is that, can I create and use delegate in my CallBack Function ?
Like what I am doing in CallBackFunction1.
Will this cause a problem with my WaitAll in Function A?
Is using AsyncCallback going to suffer any performance issue?
Or should I "pull" the status of the delegate to check to see if they are completed. (like Pulling every 5 minutes or so)
The delegate that I will be calling from Function A is expected to run for like couple hours.

Right now i am deciding whether I should use delegate with callback, or use pulling method. (or of course, you have a better way of getting it done !)

Thanks guys/gals :)
ASKER CERTIFIED SOLUTION
Avatar of nachiket
nachiket

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial