Re: beginUpdateBatch and threads

"Benjamin D. Smedberg" <[email protected]> Thu, 26 May 2005 08:27:02 -0400
Newsgroups gmane.comp.mozilla.devel.rdf
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
vaab wrote:
> This is my own solution for the moment, feel free to complete : (thx Neil)
> 
> Javascript is multithreaded, but in UI (as UI is not threadsafe) , 
> there's only one thread. This means that instruction are run 
> sequentially, and that an event can occurs only when javascript 
> instruction pointer has finished processing all code.
> 
> In my case this means that a simple batch nest counter will suffice to 
> ensure that begin/endUpdateBatch doesn't cross. This means also that 
> these fonction aren't as transaction for databases, but just thought for 
>  efficiency when several updates have to be thrown into the database.

That is the correct model. The Mozilla RDF APIs are not thread-safe, so 
the updateBatch APIs merely serve to "suspend" the frontend from 
updating until a set of RDF changes are finished. A nesting counter is 
the correct solution.

--BDS