4 ms·
wait, what? can you point to a feature name / doc / example?
by namtab00 3y ago
wait, what? can you point to a feature name / doc / example?
- texuf 3y ago[dead]
- dtech 3y agoThis is extremely similar to thread local, a feature in many languages including C#.
- jcparkyn 3y agoI'm pretty sure they were talking about AsyncLocal<T>, which is not quite the same as ThreadLocal (values are persisted even when an async flow transitions across).
- klysm 3y agoYes it’s different but conceptually similar in the sense of ambient execution context. I prefer implicit variables like scala has but it gets the job done in C#.
- debugnik 3y agoThey mean AsyncLocal<T>, which ties its storage to the current thread-local ExecutionContext. When await schedules a continuation, the ExecutionContext flows with it and is set before resuming, so the AsyncLocal values flow through async methods even if the task switches threads.