Re: [xml] Query Regarding Revision 2121 in SVN for entity nesting check in parserinternal.c

On Feb 20, 2008 2:50 PM, Daniel Veillard <veillard redhat com> wrote:
On Wed, Feb 20, 2008 at 05:32:47PM +0530, Ashwin wrote:


    I   have   a   doubt   regarding   the   revision   2121  in  SVN  in
   parserInternals.c,  a  check  for entities nesting has been added. For
   the following statement,(in function xmlNewInputStream)

   input->id = id++;

   where  id  is a static variable thread safety is not taken care of. Is
   this  because there can be only one parser context irrespective of the
   number  of  threads?  I think the comment above the code mentions this

  No the comment is about the fact that only one thread is allowed to
use a given parser context. If you didn't then the application had broken the
libxml2 API rules.

   However  I assume in case of scenarios where there is a parser context
   per thread, thread-safety is required, right?

  No. try to understand how the added check works.
The point is make sure that for a given parsing context you always get
different ids when you create new input streams. That code does it,
and the comment is right.

Sorry, but (IMO) there indded may be a problem if defferent concurent
threads running on the different CPUs.

Andrew W. Nosenko <andrew w nosenko gmail com>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]