This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: POSIX threads documentation


On Mon, Sep 13, 2010 at 5:20 AM, Florian Weimer <fweimer@bfk.de> wrote:
> I'm looking for documentation on the non-portable aspects of the POSIX
> threads implementation, but which are essential for library writers.
> (Basically, I want to make my library thread-safe, without forcing
> client code to link with -lpthread and the associated performance
> penalty.) ?In particular, I need to check if certain symbols which are
> currently provided without -lpthread are guaranteed to be available to
> non-threaded programs in the future.
>
> Is there such a documentation available somewhere?

No.

I assume you are talking about __libc_lock and associated functions
which are used internally by the C library? These functions are
pthread aware and become full locks when the pthread DSO is loaded,
but they are not, AFAIK, available for use by library writers.

Could you also please qualify the performance penalty you see when
linking with pthreads? Given your particular library how much of a
penalty do you see? Why do you think there is a performance penalty?
Is there anything the glibc community could do to help?

Shared libraries are allowed to have undefined symbol references.

Can you do this?

if (pthread_mutex_lock != 0)
{
  /* OK, thread library is loaded so we need to use a threading
     API to ensure correct handling of global data.  */
  ...
}

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]