Re: nsIThread and nsIRunnable

John Bandhauer <[email protected]> Sat, 14 Dec 2002 16:20:02 -0800
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
An lxr query - 
http://lxr.mozilla.org/seamonkey/search?string=nsIThread - 
suggests that the only JS use of nsIThread in the mozilla tree is 
the xpconnect thread stress test I wrote a couple of years ago:
http://lxr.mozilla.org/seamonkey/source/js/src/xpconnect/tests/js/old/threads.js

It is not a simple example, but a look at it might offer a clue 
or two.

Please note that pretty much the entire set of mozilla browser 
objects exposed to JS are implemented to be manipulated on the 
main thread only. If you spin another thread and have it access 
the DOM in any way you are really asking for trouble. If you use 
this stuff at all then be careful.

John.

Snider, Sean wrote:
> Hello All:
> 
>  
> 
> I noticed that nsIThread and nsIRunnable are scriptable interfaces.  
> Does that mean I can run JS code in a separate thread???
> 
> If so goody goody. .  . anybody have any examples, or even just a little 
> background on how to use these in JS?
> 
>  
> 
> Sean
> 
> [email protected]
>