mark kaplun wrote:
<...>

Thanks Darin, this are all good points. I guess the fualt was in my question I meant to try to understand the difference between using NS_IMPL_ISUPPORTS1 and NS_IMPL_THREADSAFE_ISUPPORTS1. currently I use initialy NS_IMPL_ISUPPORTS1, and only when an assertion ocoures I change it to the thread safe version. Do I simply waste my time and should always use NS_IMPL_THREADSAFE_ISUPPORTS1 ?

Mark.



To clarify the things a bit further, NS_IMPL_THREADSAFE_ISUPPORTS1 doesn't make anything threadsafe but the Addref and Release methods. And it disables the check if Addref and Release are called from different threads. Once you use the THREADSAFE versions, you still need to make sure that those functions of your object that are called from multiple threads are indeed threadsafe.


Note that the threadsafe versions of Addref and Release are more costly than the non-threadsafe ones, so if your design is weak, you might pay in performance.

Axel




Reply via email to