OpenBSD CVS

CVS log for src/lib/librthread/Attic/rthread_libc.c


[BACK] Up to [local] / src / lib / librthread

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.19, Tue Sep 5 02:40:54 2017 UTC (6 years, 9 months ago) by guenther
Branch: MAIN
CVS Tags: HEAD
Changes since 1.18: +1 -1 lines
FILE REMOVED

Move mutex, condvar, and thread-specific data routes, pthread_once, and
pthread_exit from libpthread to libc, along with low-level bits to
support them.  Major bump to both libc and libpthread.

Requested by libressl team.  Ports testing by naddy@
ok kettenis@

Revision 1.18 / (download) - annotate - [select for diffs], Sat May 27 14:20:39 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.17: +14 -2 lines
Diff to previous 1.17 (colored)

New mutex and condvar implementations based on futex(2).

Not enabled yet, it needs some SPINLOCK_SPIN_HOOK love and
some bumps.

Tested by many including sthen@ in a bulk.

ok visa@, sthen@, kettenis@, tedu@

Revision 1.17 / (download) - annotate - [select for diffs], Sun Sep 4 10:13:35 2016 UTC (7 years, 9 months ago) by akfaew
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.16: +5 -6 lines
Diff to previous 1.16 (colored)

Get rid of ticket support, replace "struct _spinlock" with "_atomic_lock_t".

ok tedu@

Revision 1.16 / (download) - annotate - [select for diffs], Thu Sep 1 10:56:46 2016 UTC (7 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.15: +1 -2 lines
Diff to previous 1.15 (colored)

delete wrong cvs $ tags

Revision 1.15 / (download) - annotate - [select for diffs], Thu Sep 1 10:41:02 2016 UTC (7 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.14: +32 -17 lines
Diff to previous 1.14 (colored)

Less lock contention by using more pools for mult-threaded programs.
tested by many (thanks!) ok tedu, guenther@

Revision 1.14 / (download) - annotate - [select for diffs], Sat May 7 19:05:22 2016 UTC (8 years, 1 month ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.13: +2 -1 lines
Diff to previous 1.13 (colored)

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a.  This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes.  'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jan 27 08:40:05 2016 UTC (8 years, 4 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.12: +21 -4 lines
Diff to previous 1.12 (colored)

Replace the malloc spinlock with a mutex.  This lock is held over system calls
which run for many cycles and may even sleep.  This leads to other threads
spinning for a long time waiting on the lock.  Using a mutex means those
threads go to sleep and get woken up when the lock is released, which results
in a lot less CPU usage.  More work is needed to improve the performance of
threaded code that suffers from malloc lock contention, but this diff makes
ports like Firefox significantly more usable.

Tested by many.

ok mpi@, guenther@, tedu@, jca@

Revision 1.12 / (download) - annotate - [select for diffs], Tue Apr 7 01:27:07 2015 UTC (9 years, 2 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.11: +18 -1 lines
Diff to previous 1.11 (colored)

Make pthread_atfork() track the DSO that called it like atexit() does,
unregistering callbacks if the DSO is unloaded.  Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.

verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jun 1 20:47:40 2013 UTC (11 years ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.10: +4 -4 lines
Diff to previous 1.10 (colored)

cleanup and consolidate the spinlock_lock (what a name!) code.
it's now atomic_lock to better reflect its usage, and librthread now
features a new spinlock that's really a ticket lock.
thrlseep can handle both types of lock via a flag in the clock arg.
(temp back compat hack)
remove some old stuff that's accumulated along the way and no longer used.
some feedback from dlg, who is concerned with all things ticket lock.
(you need to boot a new kernel before installing librthread)

Revision 1.10 / (download) - annotate - [select for diffs], Tue Apr 17 15:10:11 2012 UTC (12 years, 1 month ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.9: +1 -3 lines
Diff to previous 1.9 (colored)

Remove "#define _POSIX_THREADS" line before include <pthread.h>.
The latter contains "#define _POSIX_THREADS 1" which makes gcc 2.95 complain.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Dec 5 04:02:03 2011 UTC (12 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.8: +1 -190 lines
Diff to previous 1.8 (colored)

Implement cancelation for the basic syscall cancelation points,
using previously allocated SIGTHR to interrupt in-process syscalls
and fixing the spelling of "cancelled" along the way.
Modeled on FreeBSD's libthr

Revision 1.8 / (download) - annotate - [select for diffs], Sun Nov 6 11:48:59 2011 UTC (12 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.7: +1 -3 lines
Diff to previous 1.7 (colored)

Move <machine/spinlock.h> into rthread.h; strip out unnecessary #includes

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 13 21:18:43 2008 UTC (16 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.6: +1 -6 lines
Diff to previous 1.6 (colored)

remove _MALLOC_LOCK_INIT; major bump; ok deraadt@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jan 23 02:20:24 2008 UTC (16 years, 4 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.5: +18 -1 lines
Diff to previous 1.5 (colored)

- add missing libc locking functions for _thread_atexit_lock() and
  _thread_atexit_unlock(). okay tedu@

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jan 1 00:43:39 2008 UTC (16 years, 5 months ago) by kurt
Branch: MAIN
Changes since 1.4: +18 -1 lines
Diff to previous 1.4 (colored)

- make arc4random*() functions thread safe. Use a custom spinlock function
instead of the generic pthread macros since free(3) uses __arc4_getbyte()
when freeing small sized allocations and the generic pthread macros call
malloc(3).
- eliminate passing pointers to a static variable with global scope (rs)
for additional code clarity and reduction.
- shlib minor bumps for libc and libpthread due to new functions.
From andreas@ with some bits from me. okay tedu@ marc@ w/some spot
checking from millert@

Revision 1.4 / (download) - annotate - [select for diffs], Tue Jun 5 18:11:49 2007 UTC (17 years ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.3: +28 -1 lines
Diff to previous 1.3 (colored)

_FD_LOCK/UNLOCK() is libpthread specific and not needed for librthread, so
isolate its usage to libpthread only and replace with generic non-static
mutex support in the one place it is needed:
 - remove _FD_LOCK/UNLOCK from lseek and ftruncate in libc and make the
   functions weak so that libpthread can override with its own new
   versions that do the locking.
 - remove _thread_fd_lock/unlock() weak functions from libc and adjust
   libpthread for the change.
 - add generic _thread_mutex_lock/unlock/destroy() weak functions in libc
   to support non-static mutexes in libc and add libpthread and librthread
   implementations for them. libc can utilize non-static mutexes via the
   new _MUTEX_LOCK/UNLOCK/DESTROY() macros. Actually these new macros can
   support both static and non-static mutexes but currently only using
   them for non-static.
 - make opendir/closedir/readdir/readdir_r/seekdir/telldir() thread-safe
   for both thread libraries by using a non-static mutex in the struct
   _dirdesc (typedef DIR), utilizing it in the *dir functions and remove
   remaining and incorrect _FD_LOCK/UNLOCK() use in libc.
 - add comments to both thread libraries to indicate libc depends on the
   current implementation of static mutex initialization. suggested by
   marc@
 - major bump libc and libpthread due to function removal, structure
   change and weak symbol conversions.
okay marc@, tedu@

Revision 1.3 / (download) - annotate - [select for diffs], Fri Oct 27 02:41:24 2006 UTC (17 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.2: +192 -2 lines
Diff to previous 1.2 (colored)

two comment typos from tbert

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jan 5 04:24:30 2006 UTC (18 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.1: +23 -1 lines
Diff to previous 1.1 (colored)

move malloc lock to libc interface file

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jan 5 04:06:48 2006 UTC (18 years, 5 months ago) by marc
Branch: MAIN


add -Wstrict-prototypes -Wmissing-prototypes -Wsign-compare
Minor tweaks to compile with the above, primarily in fixing
the conflicts between semaphore.h and rthread.h
"i like the additional warnings" tedu@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.