C# IAsyncResult WaitAll -
in of implementations of waitall have seen following code
iasyncresult result1 = method.begininvoke(10, mycallback, null) iasyncresult result2 = method.begininvoke(20, mycallback, null) waithandle[] waithandles = new waithandle[] { result1.asyncwaithandle, result2.asyncwaithandle}; waithandle.waitall(waithandles) does seem right ? chances before waithandles array created 1 of calls complete ?
regards, dhananjay
makes sense me.
// begin invoking first , second method, , give them callback iasyncresult result1 = method.begininvoke(10, mycallback, null) iasyncresult result2 = method.begininvoke(20, mycallback, null) // time past point of invokation, mycallback called. // wait handles of async results, regardless of whether have finished or not waithandle[] waithandles = new waithandle[] { result1.asyncwaithandle, result2.asyncwaithandle}; // make sure wait until methods have finished. // have finished immediately, , mycallback have been called, // never past line unless have finished. waithandle.waitall(waithandles) // may have waited on function finish, or may have been done before arrived @ previous line. either way, done now. what find odd?
asking "what chances" bad sign. chances it might happen means need account program needs if , when methods complete before waitall.
Comments
Post a Comment