|
跨套间可以在任意线程上执行
|
线程可以属于该套间
|
多线程特性?
|
需要消息循环?
|
进程中套间个数
|
套间中线程个数
|
STA
|
No
|
Yes
|
单线程
|
Yes
|
无限制
|
1
|
MTA
|
No
|
Yes
|
多线程
|
No
|
1
|
无限制
|
NTA
|
Yes
|
No
|
多线程
|
No
|
1
|
无限制
|
属性值
|
含义
|
Main (缺省值)
|
主STA,也就是第一个创建的STA
|
Apartment
|
STA
|
Both
|
STA或者MTA都可以
|
Free
|
MTA
|
Neutral
|
NTA
|
|
对象套间=Main
|
对象套间=Apartment
|
对象套间=Both
|
对象套间=Free
|
对象套间=Neutral
|
线程套间=主STA
|
主STA
|
当前线程套间
|
当前线程套间
|
MTA
|
NTA
|
线程套间=STA
|
当前线程套间
|
当前线程套间
|
当前线程套间
|
MTA
|
NTA
|
线程套间=MTA
|
主STA
|
STA
|
当前线程套间
|
MTA (当前线程的套间)
|
NTA
|
线程套间=NTA
|
主STA
|
STA
|
NTA
|
MTA
|
NTA
|

<!--[if mso & !supportInlineShapes & supportFields]><span style='""><!--[if gte vml 1]> <tr> <td><![endif]> <div> <p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";font-family:"Calibri","sans-serif";"_x0000_s1030" style='position:absolute;left:704;top:23251; width:3391;height:1380' fillcolor="white [3201]" strokecolor="#4f81bd [3204]" strokeweight="1pt"> <tr> <td><![endif]> <div> <p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";font-family:"Calibri","sans-serif";"_x0000_s1032" style='position:absolute;left:704;top:20969; width:3391;height:1379' fillcolor="white [3201]" strokecolor="#4f81bd [3204]" strokeweight="1pt"> <tr> <td><![endif]> <div> <p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";font-family:"Calibri","sans-serif";"_x0000_s1034" style='position:absolute;left:3028;top:21495; width:751;height:660' fillcolor="white [3201]" strokecolor="#4f81bd [3204]" strokeweight="1pt"> <tr> <td><![endif]> <div> <p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";font-family:宋体;font-family:"Calibri","sans-serif"; font-family:"Calibri","sans-serif";"_x0000_s1036" style='position:absolute;left:3028;top:23791; width:751;height:660' fillcolor="white [3201]" strokecolor="#4f81bd [3204]" strokeweight="1pt"> <tr> <td><![endif]> <div> <p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";font-family:宋体;font-family:"Calibri","sans-serif"; font-family:"Calibri","sans-serif";"_x0000_s1038" style='position:absolute;left:7917;top:22770; width:751;height:660' fillcolor="white [3201]" strokecolor="#666 [1936]" strokeweight="1pt"> <tr> <td><![endif]> <div> <p><b style='font-family:"Calibri","sans-serif";"_x0000_t38" coordsize="21600,21600" o:spt="38" o:oned="t" path="m,c@0,0@1,5400@1,10800@1,16200@2,21600,21600,21600e" filled="f"> <![if !mso]> <table cellpadding=0 cellspacing=0 width="100%"> <tr> <td><![endif]> <div> <p><span style='"_x0000_s1043" type="#_x0000_t202" style='position:absolute; left:9087;top:21826;width:1068;height:360' filled="f" stroked="f" strokecolor="white [3212]"> <tr> <td><![endif]> <div> <p><span style=' font-family:宋体;"_x0000_s1044" type="#_x0000_t202" style='position:absolute; left:4240;top:21600;width:1068;height:360' filled="f" stroked="f" strokecolor="white [3212]"> <tr> <td><![endif]> <div> <p><span style=' font-family:宋体;"_x0000_s1045" type="#_x0000_t202" style='position:absolute; left:4240;top:24062;width:1068;height:360' filled="f" stroked="f" strokecolor="white [3212]"> <tr> <td><![endif]> <div> <p><span style=' font-family:宋体;"_x0000_t32" coordsize="21600,21600" o:spt="32" o:oned="t" path="m,l21600,21600e" filled="f"> <![endif]--><!--[if !vml]--><!--[endif]--><!--[if mso & !supportInlineShapes & supportFields]><span style='"_x0000_i1025" type="#_x0000_t75" style='width:515.2pt;height:225.75pt'> </p> <div><span style="font-family: 宋体;">刚才提到了</span>Proxy<span style="font-family: 宋体;">,那么</span>Proxy<span style="font-family: 宋体;">是怎么拿到的呢?方法一般有二:</span></div> <p style="margin-left: 0.25in; text-indent: -0.25in;"><!--[if !supportLists]-->1. <!--[endif]-->CoCreateInstance/CoCreateInstancEx
<!--[if !supportLists]-->2. <!--[endif]-->Marshalling/UnMarshalling
OK,这一次就讨论到这里,下篇文章将着重讨论STA/MTA/NTA这几类套间。敬请关注。