opnsense-src/lib/libkse/thread
Kris Kennaway 2017a7cdfe Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. This
is also implemented in glibc and is used by a number of existing
applications (mysql, firefox, etc).

This mutex type is a default mutex with the additional property that
it spins briefly when attempting to acquire a contested lock, doing
trylock operations in userland before entering the kernel to block if
eventually unsuccessful.

The expectation is that applications requesting this mutex type know
that the mutex is likely to be only held for very brief periods, so it
is faster to spin in userland and probably succeed in acquiring the
mutex, than to enter the kernel and sleep, only to be woken up almost
immediately.  This can help significantly in certain cases when
pthread mutexes are heavily contended and held for brief durations
(such as mysql).

Spin up to 200 times before entering the kernel, which represents only
a few us on modern CPUs.  No performance degradation was observed with
this value and it is sufficient to avoid a large performance drop in
mysql performance in the heavily contended pthread mutex case.

The libkse implementation is a NOP.

Reviewed by:      jeff
MFC after:        3 days
2007-10-29 21:01:47 +00:00
..
Makefile.inc Include files thr_condattr_pshared.c and thr_mattr_pshare.c. 2005-10-24 05:48:32 +00:00
thr_accept.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_aio_suspend.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_atfork.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_destroy.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_get_np.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getdetachstate.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_getguardsize.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getinheritsched.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getschedparam.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getschedpolicy.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getscope.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getstack.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_getstackaddr.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_getstacksize.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_init.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_setcreatesuspend_np.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_setdetachstate.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_setguardsize.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_setinheritsched.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_setschedparam.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_setschedpolicy.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_setscope.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_setstack.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_attr_setstackaddr.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_attr_setstacksize.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_autoinit.c
thr_barrier.c Use the correct type for and argument. Recent changes to namespace.h 2006-03-28 21:07:59 +00:00
thr_barrierattr.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_cancel.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_clean.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_close.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_concurrency.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_cond.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_condattr_destroy.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_condattr_init.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_condattr_pshared.c Add function pthread_condattr_setpshared and pthread_condattr_getpshared. 2005-10-24 05:35:14 +00:00
thr_connect.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_creat.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_create.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_detach.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_equal.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_execve.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_exit.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_fcntl.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_find_thread.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_fork.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_fsync.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_getprio.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_getschedparam.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_info.c Add a reference and lock the target thread when setting its name. 2007-04-23 03:36:14 +00:00
thr_init.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_join.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_kern.c Oops, fix a typo in the last commit :-/ 2007-03-05 19:00:49 +00:00
thr_kill.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_main_np.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_mattr_init.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_mattr_kind_np.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_mattr_pshared.c Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared. 2005-10-24 05:35:40 +00:00
thr_msync.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_multi_np.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_mutex.c Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. This 2007-10-29 21:01:47 +00:00
thr_mutex_prioceiling.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_mutex_protocol.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_mutexattr_destroy.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_nanosleep.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_once.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_open.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_pause.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_poll.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_printf.c
thr_priority_queue.c s/TMDF_DONOTRUNUSER/TMDF_SUSPEND/g 2004-08-03 02:23:06 +00:00
thr_private.h Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it. 2007-05-13 14:12:40 +00:00
thr_pselect.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_pspinlock.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_raise.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_read.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_readv.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_resume_np.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_rtld.c Don't attempt to initialize the rtld lock if it can't be malloc()'d. 2005-08-29 13:47:42 +00:00
thr_rwlock.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_rwlockattr.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_select.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_self.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sem.c Fix prototype mismatch and use of un-namespaced pthread functions. 2006-03-28 21:50:12 +00:00
thr_seterrno.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_setprio.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_setschedparam.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_sig.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sigaction.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sigaltstack.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_sigmask.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sigpending.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_sigprocmask.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sigsuspend.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sigwait.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_single_np.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_sleep.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_spec.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_spinlock.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_stack.c Increase the default stacksizes: 2005-02-13 18:38:06 +00:00
thr_suspend_np.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_switch_np.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_symbols.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_system.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_tcdrain.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_vfork.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_wait.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_wait4.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_waitpid.c Add compatibility symbol maps. libpthread (.so.1 and .so.2) 2006-03-13 00:59:51 +00:00
thr_write.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_writev.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
thr_yield.c Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00