.net - What deos ConfigureAwait do? ASP.NET Web API 2 -
i working on asp.net web api 2 application. in application using every async request:
configureawait(false);
i cannot understand mean. looked on internet still don't understand does?
to understand it, need understand synchronization context , threading models.
from practical perspective lets take @ canonical example. developing gui application (win forms or wpf). have dedicated ui thread. must update ui on ui thread , not block ui thread calculations or waiting response.
configureawait have sense async/await. default, code after await run on captured ui thread,
await doasync(); //ui updating code goes here. run on ui thread
code after await run on thread pool, if specify configureawait(false)
await doasync().configureawait(false); //cpu intensive operation. run on thread pool
you not have dedicated ui thread, far have asp.net application. synchronization context important too. understanding synchronizationcontext in asp.net give details.
Comments
Post a Comment