Thanks Crest,
I want to confirm with you that you mean we need to add thread safe
synchronization approach to AddRef and Release to make counter value thread
safe manually by developers (i.e. COM runtime engine does not provide such
function)?
regards,
George
> > Is it needed to synchronize AddRef and Release? Or the COM runtime
>
> Yes.
> Why and how are described in Don Box's Essential COM (p. 53)
Carl Daniel [VC++ MVP] - 19 Oct 2007 06:14 GMT
> Thanks Crest,
>
> I want to confirm with you that you mean we need to add thread safe
> synchronization approach to AddRef and Release to make counter value
> thread safe manually by developers (i.e. COM runtime engine does not
> provide such function)?
Yes, that's correct. AddRef/Release are typically implemented using
InterlockedIncrement and InterlockedDecrement.
-cd
George - 20 Oct 2007 15:00 GMT
Thanks for all of your help, cd!
regards,
George
> > Thanks Crest,
> >
[quoted text clipped - 7 lines]
>
> -cd
Ben Voigt [C++ MVP] - 19 Oct 2007 15:40 GMT
> Thanks Crest,
>
[quoted text clipped - 3 lines]
> safe manually by developers (i.e. COM runtime engine does not provide such
> function)?
*If* you mark your component with the single-threaded or apartment threading
model then you needn't worry.
Other threading models need to use InterlockedXYZ functions as Carl
mentioned.
> regards,
> George
[quoted text clipped - 3 lines]
>> Yes.
>> Why and how are described in Don Box's Essential COM (p. 53)
George - 20 Oct 2007 15:01 GMT
Hi Ben,
I am interested to learn the basics of apartment thread model. Could you
recommend some learning materials?
regards,
George
> > Thanks Crest,
> >
[quoted text clipped - 17 lines]
> >> Yes.
> >> Why and how are described in Don Box's Essential COM (p. 53)
Alex - 22 Oct 2007 05:43 GMT
http://www.codeproject.com/com/#COM

Signature
Thanks & Regards,
Alex.
> Hi Ben,
>
[quoted text clipped - 25 lines]
> > >> Yes.
> > >> Why and how are described in Don Box's Essential COM (p. 53)
Alex - 22 Oct 2007 05:44 GMT
http://www.codeproject.com/com/#COM

Signature
Thanks & Regards,
Alex.
> Hi Ben,
>
[quoted text clipped - 25 lines]
> > >> Yes.
> > >> Why and how are described in Don Box's Essential COM (p. 53)
George - 22 Oct 2007 07:25 GMT
Thanks Alex,
regards,
George
> http://www.codeproject.com/com/#COM
>
[quoted text clipped - 27 lines]
> > > >> Yes.
> > > >> Why and how are described in Don Box's Essential COM (p. 53)