libtool-patches
[Top][All Lists]
Advanced

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

Re: [RFC] pre-c89 in libltdl


From: Simon Josefsson
Subject: Re: [RFC] pre-c89 in libltdl
Date: Fri, 16 Apr 2004 00:10:22 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Bob Friesenhahn <address@hidden> writes:

> On Thu, 15 Apr 2004, Simon Josefsson wrote:
>
>> I'm coming to that conclusion too.  But what if libltdl (perhaps as
>> part of its autoconfery) could tell me if dlopen (or whatever system
>> interface libltdl uses) was thread safe or not?  Having it do that
>> would be useful, even if it would only indicate thread safety on Linux
>> or HURD.  (Assuming those dlopen's are thread safe...)
>
> Libtool can't tell you if the system interface is thread safe.  The
> manual page might tell you if the interface is thread safe.  Whether
> the interface is thread safe or not may differ between minor versions
> of the operating system or versions of the C library.

Ok.

> I hate to be the one to tell you this, but your "reentrant" C89 code
> may not actually be thread safe by default.  The reason for this is
> that often times the system will apply alternate header file
> definitions if the code is specifically compiled for thread safety.
> For example, the system may supply a special thread-safe errno
> definition and provide modified stdio macro definitions (which do
> locking) if _REENTRANT (or whatever) is defined.  That means you need
> to worry about threads even your code only uses C89 interfaces if you
> expect your library to execute safely with multiple threads.
>
> Some systems will supply an alternate C library, or other libraries if
> the application is built to be thread safe.
>
> There is no free lunch when it comes to thread safety.

Right... I'm trying to move away from errno, stdio and stuff like that
for this reason.  I'm pretty much there.  But this part of the problem
is not a big worry for me, as I don't ship binaries, just re-entrant
C89 source code.  Whoever compiles have to decide for their users what
kind of options they want to apply, and think about the implications
for threads etc.  (At least this is the shiny ideal world I'd like to
believe I live in.)

Thanks,
Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]