I'm aware that HttpContext
property of controller is async-safe. When you call it inside async action, it always returns context of the current action.
But I'm curious how is this achieved?
If I understand correctly, it can't be implemented using thread-local storage technique. Because after await
, an async method can resume on another thread from pool. Or, on the other hand, while an async method is "sleeping", the same thread from pool can execute another async method.