I'm currently porting an IE toolbar to Firefox and I'm having some
problems related to concurrency. I have a simple XPCOM C++ dispatcher
between javascript and our native win32 application that essentially
acts as a proxy between the two, simply delegating events back and
forth. When I'm e.g. connecting to our native app from Firefox
(JavaScript -> C++), I'm immediatelly fireing an event to notify
observer that a connection has been made or failed. This occures in the
calling thread and works as expected.
However, our native app will deliver events asynchronously, which
requires events to get posted to JS from arbitrary threads. In the
current setup, invoking certain functions (alert, dump, window.status
etc) will cause the browser to hang.
So, what do I need to do to avoid deadlocks? Do I need to marshal
invokations to a particular thread? If so, how? Are there any
fundamental rules related to threading in XPCOM, and if so, where are
these defined?
Regards,
Nille
> So, what do I need to do to avoid deadlocks? Do I need to marshal
> invokations to a particular thread?
Yes, see http://www.mozilla.org/projects/xpcom/Proxies.html
Nickolay