[NLUUG]   Welcome to ftp.nluug.nl
Current directory: /pub/ftp/os/NetBSD/NetBSD-current/xsrc/external/mit/libpthread-stubs/dist/
 
Current bandwidth utilization 1287.81 Mbit/s
Bandwidth utilization bar
Contents of README:
Project description
-------------------

Currently the project provides only a pkg-config [.pc] file, pthread-stubs.pc.
The latter contains the Cflags/Libs flags applicable to programs/libraries
that use only lightweight pthread API. See the next sections for the reasoning
and implementation details.

Historically this project used to provide either:
 - a .pc file, when the C runtime was providing the pthread symbols
or
 - a .pc file and a library which implements weak stubs for the pthread symbols,
which are not available in the C runtime.

Since then, the latter case was found to have a fundamental design issue.


Design
------

On platforms where the lightweight pthread symbols are provided by the runtime,
the .pc files provides empty Cflags/Libs flags.

Currently the following platforms fit the above category:
 - GNU/Linux - GCC/Clang/GLibC/Musl
 - Solaris 10 and later
 - Cygwin
 - GNU/Hurd
 - GNU/kFreeBSD

For others, each of Cflags/Libs expands to full blown pthread.

For example:
 - FreeBSD and derivatives
 - OpenBSD - uses a heavily patched copy of pthread-stubs to workaround this
 - other BSD platforms ?

Unchecked:
 - MSYS/MINGW
 - Darwin - GCC/Clang - should be the same as their Linux counter part


Many platforms have their own eccentric way of managing pthread compilation and
linkage. The ones realistically supported by pthread-stubs [and projects that
depend on it] work with '-pthread'.

GCC supports -pthread for:
Aarch64, ARM, Darwin, IA-64, MIPS, PowerPC, SPARC, x86
Cygwin and x86 Windows may need a trivial patch for older GCC versions.
See SVN rev 214161 and 171833/171834 respectively.


Clang:
Aarch64, ARM, x86 and likely others.

SunCC/Oracle compiler:
Requires -mt -lpthread. As of Solaris 10 (oldest currently supported version)
all the pthread API lives in libc. Thus we'll _never_ get here.


With previous design, one could get mismatched calls to the pthreads API.
Consider the following scenario:
 - Program and/or its dependencies links only against libpthread-stubs,
since it uses lightweight API. Say pthread_mutex_lock.
 - At a later stage the program and/or its dependencies dlopens a library
which effectively [either directly or via any of its own dependencies] pulls a
full blown pthread. Let's call that libB.
 - The libpthread-stubs weak symbols get overridden by the libB ones.
 - pthread_mutex_unlock is executed (which now originates from libB) and BOOM.

Amount and severity of issues depend on a number of factors. In either case
things go horribly wrong sooner on later.


The symbols
-----------

The following list of symbols is taken from the libc provided by GLibC.

It is deemed sufficient and reasonably accurate of what the 'lightweight'
pthread symbols are, since GLibC is one of the few (the only) implementations
which has the distinct split.

Most/all other C runtime implementations provide all the pthread API in a
single library.

Note that the following list is incomplete wrt libc-2.24.so and that further
symbols may be added in the future to bring the two closer. Adding symbols
which are not available in GLibC libc is NOT allowed.

   pthread_condattr_destroy
   pthread_condattr_init
   pthread_cond_broadcast
   pthread_cond_destroy
   pthread_cond_init
   pthread_cond_signal
   pthread_cond_timedwait
   pthread_cond_wait
   pthread_equal
   pthread_exit
   pthread_mutex_destroy
   pthread_mutex_init
   pthread_mutex_lock
   pthread_mutex_unlock
   pthread_self

Icon  Name                                                                  Last modified      Size  
[DIR] Parent Directory - [DIR] CVS/ 05-Jul-2024 05:02 - [TXT] COPYING 17-Mar-2014 04:33 1.2K [   ] Makefile.am 05-Jul-2024 05:02 69 [TXT] Makefile.in 05-Jul-2024 05:02 20K [TXT] README 05-Jul-2024 05:02 3.4K [TXT] aclocal.m4 05-Jul-2024 05:02 41K [TXT] compile 04-Jul-2024 07:08 7.2K [TXT] configure 05-Jul-2024 05:02 159K [TXT] configure.ac 05-Jul-2024 05:02 962 [TXT] install-sh 05-Jul-2024 05:02 15K [TXT] missing 05-Jul-2024 05:02 6.7K [TXT] pthread-stubs.pc.in 05-Jul-2024 05:02 228

NLUUG - Open Systems. Open Standards
Become a member and get discounts on conferences and more, see the NLUUG website!