c# - fastest and optimized way to load async result -
What is the fastest and most optimistic way to load asynchronous results from different sources in web services? Dictionary & lt; String, int & gt; ReadySources = GetReadyHotelSources (member); Eventflag = new autorat avant [ready source.count]; Int maxTimeOut = 0; Int i = 0; Forwarding (KeyWalkueer & lt; string; et & gt; Active Source In Ready Source) {maxTimeOut = (int) activeSource.Value & gt; MaxTimeOut? (Int) activeSource.Value: maxTimeOut; I ++; } Int j = 0; {If (readySources.ContainsKey (deThread.Key)) {ThreadPool.QueueUserWorkItem (deThread.Value, j); foreach (keyvaluePair & lt; string; waiting buckle & gt; list; Event Flagged [J] = New AutoSetset (false); J ++; }} If (Jay! = 0) {If yes (Wait!) Waiting for all (eventflag, new timespace (0, 0, maxtime), true)) {/ TODO: Audit which time has expired}} // Combined Source Results = Connecthotels ();
Now I want to transfer this code to the async mode in web services. Use the asynchronous
task based API and, as described here, :
Avoid avoiding waiting time with
. Run () , here's what I mean. Generally you do not need to create new threads or use the pool thread on the server side clearly. You get your WCF services from Asynchronous to
Task Call on the FactorFormSync , like
Comments
Post a Comment