Technically yes.

However if you know the environment in which the component is used, you
"can" get away with it.

In the example given, most of the variables etc are on stack (not related to
the object eg private/public) so they are automatically thread safe.
Normally only writing to object data needs to be protected - not reading
when using multi-threading/both models.

Setting the threading model to Apartment would result in much slower calls
to the object, as if the object was created in a different apartment from
the orginal MTS/ASP call - which is very likely, the call would have to be
marshalled between apartments. Remember apartment means single threaded
apartment, and under the COM model there can be MANY single threaded
apartments.

Myles.

> -----Original Message-----
> From: Neil Anderson [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, 15 March 2000 08:18
> To:   Multiple recipients of list delphi
> Subject:      [DUG]:  ASP Delphi MTS and threading models
> 
> Hi All
> 
> Just when I think I am starting to understand the different threading 
> models etc I start doubting what I think I know.
> 
> In the article at the link below they create a MTS/ASP COM object and set 
> the threading model to both.
> My guess is that MTS will run the COM object in an apartment model, but 
> what if you develop the object to run without MTS ? Also why not just set 
> the threading model to apartment even if used within MTS ?
> I thought you had to write thread safe code before setting the model to 
> both.
> 
> http://www.yasdbooks.com/devaspcomp/bonus/delphi.htm
> 
> Neil ANderson
> 
> --------------------------------------------------------------------------
> -
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to