Re: [xslt] read XML File - atomic action?



On Fri, Sep 07, 2001 at 08:12:19PM +0200, Bernhard Zwischenbrugger wrote:
> Hi
> 
> In my software there are prozesses that write an XML-File an
> prozesses that read this XML-File.
> (apache, php)
> 
> My question:
> Are the read and write operations of xsltproc
> atomic operations?

 no they are progressive.

> Is it a problem if the xml-file is modified while
> xsltproc reads this files?

  I can be a problem if there isn't some underlying synchronization
done at the filesystem level.
  For example on a POSIX system if you do the following
    Process 1                  Process 2
    open( ,"r")
    read()                     open(, "w")
    read()                     write()
    read()                     write()
    close()                    write()
                               close()

  you may end-up with incoherent data. However

    Process 1                  Process 2
    open( ,"r")                unlink()
    read()                     open(, "w")
    read()                     write()
    read()                     write()
    close()                    write()
                               close()

is safer, in the sense you may get a retryable error on open("r") but won't get
corrupted data.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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