单线程单元VS多线程公寓 [英] Single-Threaded Apartments vs Multi-Threaded Apartments

查看:271
本文介绍了单线程单元VS多线程公寓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  

可能重复:
  你能解释一下STA和MTA?

  

所有的线程池线程都在   多线程的单元。

- 根据MSDN的

这是什么意思?我真的很关心VS单线程单元模型多之间的区别是什么。或者是什么的单元模型是什么意思?我已阅读就可以了MSDN,并且它并没有真正意义的我。我想可能有一个想法,但我想有人在这里可以用简单的英语解释。

谢谢, 安东尼ð

更新1

发现这个 你能解释一下STA和MTA?

任何人都可以更具描述?

更新2

我也在寻找如何适用于线程池,和我有什么需要注意的,因为这样的一个答案。

解决方案

STA(单线程单元)和MTA(多线程单元)都做的COM 。 COM组件可被设计成由单个线程,在这种情况下,它它们中承载一个 STA <被访问/一>,也可以进行内部线程安全的,并托管在 MTA 。一个进程可以只有一个MTA,但是很多的STA。如果你只是要消耗COM组件所有​​你真正需要知道的是,你必须匹配公寓到组件或讨厌的事情将会发生。

Possible Duplicate:
Could you explain STA and MTA?

All ThreadPool threads are in the multithreaded apartment.

--As per the MSDN

What does that mean? I am really concerned with what the difference between the multi vs single threaded apartment model is. Or what does the apartment model mean? I have read the MSDN on it, and it doesn't really make sense to me. I think I may have an idea, but I was thinking someone on here could explain it in plain English.

Thanks, Anthony D

Update 1

Found this Could you explain STA and MTA?

Can anyone be more descriptive?

Update 2

I am also looking for an answer about how this applies to the thread pool, and what I need to watch out for because of this.

解决方案

STA (single-threaded apartment) and MTA (multi-threaded apartment) are to do with COM. COM components can be designed to be accessed by a single thread, in which case it they are hosted in an STA, or they can be made internally thread safe, and hosted in an MTA. A process can have only one MTA, but many STAs. If you're only going to consume COM components all that you really need to know is that you have to match the apartment to the component or nasty things will happen.

这篇关于单线程单元VS多线程公寓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆