Anandprasanna Gaitonde wrote:

> HI all,
> 
> I am eager to know  the meaning of  the macro
> NS_IMPL_THREADSAFE_ISUPPORTS4(...)


A component can identify itself as being "threadsafe"
by returning "NS_OK" in response to a call to QueryInterface()
with an interface ID of NS_ISTHREADSAFE_IID.

The macro is defined here ...

http://lxr.mozilla.org/mozilla/source/xpcom/base/nsISupportsUtils.h


> What does it do and when should it be used.???


It operates the same as NS_IMPL_ISUPPORTSx() but includes the
extra interface ID that marks the component as threadsafe.


> Actually i am using it and getting a Debug Assertion failure.in file
> dbgheap.c  . I am working on WIN NT.


You'll need to be more specific - what line? In most cases, debug
assertions related the threading are caused by the debug code checking
to verify that the thread that allocated a chunk of memory is the
same on that frees it. Simply replacing NS_IMPL_ISUPPORTS with
NS_IMPL_THREADSAFE_ISUPPORTS won't fix this. You may want to look
at implementing nsIRunnable interface and also take at look at
the service manager's GetProxyForObject (or something like that)
method to assist in threading issues.


> Please provide info on the macro.
> 
> Thanks ina advance

Good luck,
Rick



Reply via email to