Thread returning to thread pool when using await

前端 未结 2 1455
闹比i
闹比i 2021-01-25 21:49

However, with ASP.NET Web Api, if your request is coming in on one thread, and you await some function and call ConfigureAwait(false)

相关标签:
2条回答
  • 2021-01-25 22:16

    What's am I missing here?

    You are missing compiler warnings

    Warning CS1998 This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

    0 讨论(0)
  • 2021-01-25 22:22

    The method foo isn't really asynchronous as there are no await calls in it.
    Try adding await Task.Delay in there.

    0 讨论(0)
提交回复
热议问题