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

Re: Request official mandate for -D_REENTRANT



David Engel <david@sw.ods.com> wrote:
>Yes!  Even if a library doesn't support threads itself, it still needs
>to be compiled with -D_REENTRANT so that it picks up the threaded
>portions of libc.  For example, errno is handled differently depending
>on whether or not -D_REENTRANT is used.  When -D_REENTRANT is not
>used, errno is simply a global integer.  When -D_REENTRANT is used,
>errno is a macro which evaluates to the lvalue of a per-thread
>integer.  So if libdb uses errno (pretty likely) and isn't compiled
>with -D_REENTRANT, it can't safely be used by a threaded application.

But what if the library _itself_ has been written in a non-thread-safe
manner? I recognise that -D_REENTRANT modifies the libc behavior, by
selecting the thread-safe functions; but if some library is compiled
with that define, and isn't written to be thread safe (eg, globals are
modified)...

As an incidental aside, once I get 1.2 up and running, I'll recompile
libelf with -D_REENTRANT.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: