您的位置:首页 > 其它

Apartment之COM中的线程模型

2012-12-23 21:21 267 查看
An apartment is a set of threading rules sharedby a group of objects。The three types of apartments aresingle-threaded apartments (STAs), neutral apartments (NAs), and multithreadedapartments (MTAs).

每一个STA中只能由一个线程,MTA中可以有多个线程。一个process可以有多个STA, 但只能有一个MTA, 一个NA。

组件中的对象支持的线程模型与Apartment之间的关系:

ThreadingModel ValuesDescription
Not presentSingle-threaded legacy component that runs only in the main STA
ApartmentSTA
NeutralNA
FreeMTA
BothSupports the STA, NA, and MTA models
现在我们知道的信息是组件中对象支持的threading model,这个可以通过注册表中的InprocServer32键值获取。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: