I'm currently making use of xpcom for some transport related things...

I do the following in the main thread...

NS_InitXPCOM(&m_serviceManager, binpath);

Get some services
rv = m_serviceManager->GetService(kEventQueueServiceCID,
kEventQueueServiceIID,
                                     (nsISupports**) &m_eventQService);
rv = m_eventQService->CreateThreadEventQueue();
rv = m_serviceManager->GetService(kIOServiceCID, kIOServiceIID,
                                      (nsISupports**) &m_ioService);

Next I use IOService to create new channel and do some things... this all
works so long as it all happens on the main thread.

However, there are some synchronous operations that might happen on a
different thread... as soon as I call m_ioService->NewChannel on another
thread I get assertions about owning thread etc..

Obviously I can't pass interfaces between threads like this...  So my
question is what is the right way?  In the COM world I would marshal the
interface using different api's...  Is there some way in xpcom to marshal
these interfaces between threads ?

Insight appreciated,

-pete





Reply via email to