Re: Threading model
From: Tony Proctor (tony_proctor_at_aimtechnology_NOSPAM_.com)
Date: 08/11/04
- Next message: Joe: "Re: Late Binding vs. Early Binding"
- Previous message: Hanna-Barbera: "Windows Installer launches for some reason"
- In reply to: Fie Fie Niles: "Threading model"
- Next in thread: Fie Fie Niles: "Re: Threading model"
- Reply: Fie Fie Niles: "Re: Threading model"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 11 Aug 2004 16:19:51 +0100
'Apartment threaded' is the norm for DLLs/OCXs. It means that the objects
from the DLL are created in apartment associated with the calling thread.
This is not really an issue unless you're in a multi-threaded environment
(e.g. MTS, IIS, or an ActiveX EXE with a threading option set). Under those
conditions, it is very important.
'Single-threaded' on the other hand, should never be used -- unless you have
an exceptionally good reason. It forces all objects from that DLL to be
created in the main STA apartment. If the thread requesting the creation
isn't the main thread (and it's best not to make such assumptions) then it
would require cross-thread marshalling to invoke it, and that's very slow.
[some background: a process can have multiple STA apartments, but only a
single MTA apartment. The first STA apartment created in a process is also
known as the main STA]
Tony Proctor
"Fie Fie Niles" <fniles@wincitesystems.com> wrote in message
news:OVsHSm6fEHA.712@TK2MSFTNGP09.phx.gbl...
> What is the difference between apartment threaded model and single
threaded
> model ?
> When creating ActiveX DLL or ActiveX controls, how do you know which
> threading model to choose ?
> Thank you.
>
>
>
- Next message: Joe: "Re: Late Binding vs. Early Binding"
- Previous message: Hanna-Barbera: "Windows Installer launches for some reason"
- In reply to: Fie Fie Niles: "Threading model"
- Next in thread: Fie Fie Niles: "Re: Threading model"
- Reply: Fie Fie Niles: "Re: Threading model"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|