Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Concurrency

0 views
Skip to first unread message

Nille

unread,
Oct 7, 2006, 4:55:03 PM10/7/06
to
Hi,

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

Nickolay Ponomarev

unread,
Oct 8, 2006, 6:31:49 PM10/8/06
to Nille, dev-ext...@lists.mozilla.org
On 7 Oct 2006 13:55:03 -0700, Nille <amid...@hotmail.com> wrote:
> 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.
>
Right, DOM can only be accessed from the main thread.

> 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

0 new messages