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 "Scott A. Herod" <he...@interact-tv.com> on 2001/04/30 20:21:12 UTC

How to make it reentrant?

Hello,

  I watched the discussion about Xerces-C being reentrant a bit ago.
( It seems that archive.covalent.net is not answering the phone anymore
so I've not searched the archive again. )

The faq says:
"No. XMLPlatformUtils::Initialize() can only be called once per
process. Call Initialize() when you start and Terminate() when
you end."

Looking through the code in PlatformUtils.cpp it looks like you
can safely call Terminate as long as there is always one open 
Initialization.  That is because both Terminate and Initialize
watch a variable gInitFlag and return immediately if it is bigger
than 0 ( or 1 ).

I've got a multi-threaded app that makes use of several modules
dynamically linked at runtime.  Many of the modules make use
of XML based configuration files.  It appears that the modules 
can all call Initialize and Terminate safely provided that the
main app. has called Initialize prior to the modules being loaded
and if the main app. does not call Terminate while it is possible 
that another module will run.

Does that sound correct?

Secondly, is it use the atomicOpsMutex.fHandle that causes
problems with the Init and Term being reentrant in the Linux
code?

Thanks,

Scott

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