Free threaded model
-
Will I be able to address all the requirements with a free threaded model? Assuming I have an efficient synchronization mechanism in place. Single,Multi apartments can ever be avoided?
---------------------------- 286? WOWW!:-O
_8086 wrote:
Will I be able to address all the requirements with a free threaded model?
Ummm, what requirements? :confused:
_8086 wrote:
Single,Multi apartments can ever be avoided?
A COM server resides in either a Single Threaded Apartment or a MultiThreaded Apartment. To avoid the use of them you should not use COM at all.... I guess you have to clarify your question (a lot, probably).
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
_8086 wrote:
Will I be able to address all the requirements with a free threaded model?
Ummm, what requirements? :confused:
_8086 wrote:
Single,Multi apartments can ever be avoided?
A COM server resides in either a Single Threaded Apartment or a MultiThreaded Apartment. To avoid the use of them you should not use COM at all.... I guess you have to clarify your question (a lot, probably).
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
_8086 wrote:
Will I be able to address all the requirements with a free threaded model?
Ummm, what requirements? :confused:
_8086 wrote:
Single,Multi apartments can ever be avoided?
A COM server resides in either a Single Threaded Apartment or a MultiThreaded Apartment. To avoid the use of them you should not use COM at all.... I guess you have to clarify your question (a lot, probably).
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknownOk let me try to explain better. I write a COM component that runs multiple threads inside. A simple CreateThread used. I use critical sections to protect objects inside the thread function. What is this model called? I think this is free threaded model. Also, when I read about STAs they say it deals with UI messages. It makes me tried. After all these brain squeezing efforts to understand COM, when I felt I'm okay with the concepts, a thunder on the head again. What the frack UI messages have got to do with a COM component. I know the dumbness is on my side, but I really don't understand. May be they are talking about Active-x? Understanding this threading models looks like nightmare. If you can help me with a casual explanation. I'd be grateful.
---------------------------- 286? WOWW!:-O
-
Ok let me try to explain better. I write a COM component that runs multiple threads inside. A simple CreateThread used. I use critical sections to protect objects inside the thread function. What is this model called? I think this is free threaded model. Also, when I read about STAs they say it deals with UI messages. It makes me tried. After all these brain squeezing efforts to understand COM, when I felt I'm okay with the concepts, a thunder on the head again. What the frack UI messages have got to do with a COM component. I know the dumbness is on my side, but I really don't understand. May be they are talking about Active-x? Understanding this threading models looks like nightmare. If you can help me with a casual explanation. I'd be grateful.
---------------------------- 286? WOWW!:-O
Okay. So how about starting with the articles here at CP? Lim Bio Liong has written a nice article series that can be found here[^]. There's a lot to be learned about COM and especially the understanding of the concept of apartments. In short it boils down to that a thread that creates a COM server must always pump messages; it has to do with marshalling and RPC (deep technical stuff). Free-threading looks a little bit different depending on whether the server is an in-process or an out-of-process server. But in both cases it means that the server will be called in different thread contexts and thus thread synchronization is essential inside the server. To use free-threading you have to create the server inside an MTA. Creating the server inside an STA guarantees that the server will nly be called from the same thread context as long as you obey the COM rules and marshal interfaces properly across apartment boundaries.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
Okay. So how about starting with the articles here at CP? Lim Bio Liong has written a nice article series that can be found here[^]. There's a lot to be learned about COM and especially the understanding of the concept of apartments. In short it boils down to that a thread that creates a COM server must always pump messages; it has to do with marshalling and RPC (deep technical stuff). Free-threading looks a little bit different depending on whether the server is an in-process or an out-of-process server. But in both cases it means that the server will be called in different thread contexts and thus thread synchronization is essential inside the server. To use free-threading you have to create the server inside an MTA. Creating the server inside an STA guarantees that the server will nly be called from the same thread context as long as you obey the COM rules and marshal interfaces properly across apartment boundaries.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown