Lev Serebryakov wrote:
When XPCOM + XUL + JS + ... pretend to be a platform (XULRunner is not released yet, I know, but it is here and I try to write full-blown application absed on it, and I'm not alone!), it seems, that there are threads (nsIThread), but not semaphores, events and/ore mutexes in XPCOM.
Yeah, threading from JavaScript does not work so well currently...
Now it is even impossible to know, is thread running or finished (join() will block, it is not a solution). And I can not find method to post thread on other thread in JavaScript (nsIEventTarget has method for this, but it marked as [noscript])!
There are plans to provide an interface for posting an nsIRunnable to an event target, but that's not finished yet.
And is ther any way to signal some event from background thread to UI one? For example, I need to notify UI thread, that background one finished it work and data is ready to show
Yeah. You can use an XPCOM proxy for that (http://www.mozilla.org/projects/xpcom/Proxies.html). For example, you can use an proxy for an nsIObserver implementation and communicate using the observe() method. Or you can, of course, use your own interface, or some other existing one.
smime.p7s
Description: S/MIME Cryptographic Signature