Re: [xml] Multithread behaviour on Solaris

Gary Pennington wrote:

Daniel Veillard wrote:

On Thu, Jun 07, 2001 at 10:41:20AM +0200, Fabrice DESRE - FT.BD/FTRD/DMI/GRI wrote:

 I'm using libxml/libxslt on Solaris in a multithreaded
application and found an easy to fix bug : The _REENTRANT
flag has to be specified when compiling the library to
avoid inconsistent behaviour of errno.
  Including <errno.h> with _REENTRANT defined make errno
a macro that gets the correct value when in a thread.
Otherwise you always get 0 :-(

That's not correct. If a threaded application calls into a thread-unsafe library, then
you still get a per-thread errno as long as you had defined _REENTRANT and included
<errno.h> . Make sure that your threads are not entering libxml2 in an unsafe fashion
and you should be ok.

 Hello Gary,
 I'm not sure to follow you there. If I compile libxml2 as
thread-unsafe, how including
<errno.h> in my application will prevent libxml to use the bad errno ?
The choice for
errno being an int or a macro is done at compile time in errno.h so you
need to
compile a thread-safe library.
 Considering libxml thread safety on Solaris, I agree with you that the
user should have
the choice to compile one version or the other (ie thread safe/unsafe,
solaris threads/posiw threads)



Fabrice Desré - France Telecom R&D/DMI/GRI
Tel: +(33) 2 96 05 31 43
Fax: +(33) 2 96 05 32 86

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