You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by James Williams - Sun East Coast IR Development <ja...@sun.com> on 2003/10/27 22:53:25 UTC

DOMWriter thread safety

do the same rules that apply to parser instances apply to DOMWriter 
instances
with respect to thread safety?

The FAQ says the following about parser instances:

> Within an address space, an instance of the parser may be used without
> restriction from a single thread, or an instance of the parser can be accessed
> from multiple threads, provided the application guarantees that only one thread
> has entered a method of the parser at any one time.

> When two or more parser instances exist in a process, the instances can
> be used concurrently, without external synchronization. That is, in an
> application containing two parsers and two threads, one parser can be running
> within the first thread concurrently with the second parser running within the
> second thread
  

Basically, can I reuse the same writer instance in 2 separate threads 
without  synchronization?
I expect the answer is no, just wanted to make sure.

Thanks,
Jim Williams


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: DOMWriter thread safety

Posted by Sean Kelly <se...@ffwd.cx>.
On Mon, 27 Oct 2003, James Williams - Sun East Coast IR Development wrote:
>
> > When two or more parser instances exist in a process, the instances can
> > be used concurrently, without external synchronization. That is, in an
> > application containing two parsers and two threads, one parser can be running
> > within the first thread concurrently with the second parser running within the
> > second thread
>
> Basically, can I reuse the same writer instance in 2 separate threads
> without  synchronization?

Depends on whether you expect both threads to be simultaneously accessing
the writer instance.  If the answer is no, then you're fine.

Sean

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Hi,Re: DOMWriter thread safety

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	from a quick look at the code I would agree with you that the 
answer is no. I will put on the todo list to check out this stuff and 
improve the documentation before the next release.

Gareth

On Mon, 27 Oct 2003, James Williams - Sun East Coast IR Development wrote:

> do the same rules that apply to parser instances apply to DOMWriter 
> instances
> with respect to thread safety?
> 
> The FAQ says the following about parser instances:
> 
> > Within an address space, an instance of the parser may be used without
> > restriction from a single thread, or an instance of the parser can be accessed
> > from multiple threads, provided the application guarantees that only one thread
> > has entered a method of the parser at any one time.
> 
> > When two or more parser instances exist in a process, the instances can
> > be used concurrently, without external synchronization. That is, in an
> > application containing two parsers and two threads, one parser can be running
> > within the first thread concurrently with the second parser running within the
> > second thread
>   
> 
> Basically, can I reuse the same writer instance in 2 separate threads 
> without  synchronization?
> I expect the answer is no, just wanted to make sure.
> 
> Thanks,
> Jim Williams
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org