[Project_owners] Re: nsIThread and RDF

Axel Hecht axel at pike.org
Sun May 16 20:56:04 EDT 2004

> Hello,
>  I am writing a simple XUL program in javascript that reads an XML
> file, converts it to RDF format, and show it in XUL trees. The XML file
> would be a bit large, and the RDF converstion takes, sometimes, a few
> seconds. In this time the XUL window does not refresh so the user could
> think that the programs hangs up. I have tried to make this conversion
> function in a separate thread but the programm really hang up when this
> nsIThread try to access the datasource object of the main thread (and if
> I try to create the datasource object in the second thread, when I use
> it on the main thread the program hangs too). I have seen that you must
> use getProxyForObject for RDF objects, but if I do this the convertion
> process takes very, very long time. Does anyone know if I have making
> something wrong? Do you know same sample code that makes something like
> this in javascript?
> Thanks in advance for your help.

AFAIK multithreadness in RDF is not consistently implemented.

proxies go thru the event queue for each call, so yes, that's gonna be slow.

You might wanna ask in .rdf, where bsmedberg might have ideas about 
reentrant RDF code.

In general, doing multithreading doesn't help you a good deal. You could 
try to cut up your work into chunks and use timers, see nsITimer, to 
restart the work.


More information about the Project_owners mailing list