CallContext中VS ThreadStatic

编程入门 行业动态 更新时间:2024-10-25 12:18:34
本文介绍了CallContext中VS ThreadStatic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

什么是CallContext中和ThreadStatic之间的区别是什么?

What are differences between CallContext and ThreadStatic?

我已经理解的是,在ASP.NET环境存储在CallContext中数据可以在整个请求被持久直到它结束而ThreadStatic可能或可能不工作,因为该请求可以切换线程。我还了解到,HttpContext的是使用CallContext中内部存储的。

I've understood that in an ASP.NET environment data stored in CallContext could be persisted throughout the request until it ends while ThreadStatic may or may not work since the request may switch threads. I've also learned that the HttpContext is internally stored using the CallContext.

在一个普通的应用程序,他们似乎都延续到同一个线程调用。如果不是这样吗?

In a regular application they both seem to persist throughout the same thread call. When isn't this the case?


编辑:在我得知调用上下文是一个抽象的概念在一个线程静态存储的注释。 ASP.NET框架从一个线程的数据明确地移动到该是处理一个请求的下一个。其他框架,要提供线程的灵活性可以做同样为上下文存储。

In the comments I learned that the call context is an abstraction over a thread static store. The ASP.NET framework explicitly moves the data from one thread to the next that is to handle one request. Other framework that wants to provide thread agility could do the same to for contextual storage.

推荐答案

很多时候,一个请求将在整个使用同一个线程,但它肯定不会总是如此 - ASP.NET展品的螺纹敏捷。有一个关于此的Spring.NET论坛的。这是指对此事的深入的博客文章。我猜想,进入更多详细信息比你来到这里:)

Very often a request will use the same thread throughout, but it certainly won't always be the case - ASP.NET exhibits thread agility. There's a really useful discussion about this on the Spring.NET forums. This refers to an in-depth blog article about the matter. I suspect that goes into more details than you'll get here :)

什么相互矛盾的信息,你看到了,出于兴趣?

What conflicting information did you see, out of interest?

更多推荐

CallContext中VS ThreadStatic

本文发布于:2023-11-08 11:11:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569204.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:CallContext   ThreadStatic

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!