freebsd-dev/lib/libthr/thread
Konstantin Belousov 6044c03a37 Apparently there are some popular programs around which assume that it
is safe to call pthread_mutex_init() on the same shared mutex several
times.  POSIX claims that the behaviour in this case is undefined.

Make this working by only allowing one caller to initialize the mutex.
Other callers either see already completed initialization and do
nothing, or busy-loop yielding while designated initializer finishes.
Also make the API requirements loose by initializing mutexes on other
pthread_mutex*() calls if they see uninitialized shared mutex.

Only mutexes provide the hack for now, but it could be also
implemented for other process shared primitives from libthr.

Reported and tested by:	"Oleg V. Nauman" <oleg@opentransfer.com>
Sponsored by:	The FreeBSD Foundation
2016-03-22 10:51:42 +00:00
..
Makefile.inc Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_affinity.c
thr_attr.c
thr_autoinit.c
thr_barrier.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_barrierattr.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_cancel.c The SUSv4tc1 requires that pthread_setcancelstate() shall be not a 2013-06-19 04:47:41 +00:00
thr_clean.c _pthread_cleanup_push: fix allocator sizeof operand mismatch 2015-04-22 16:51:21 +00:00
thr_concurrency.c
thr_cond.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_condattr.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_create.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_ctrdtr.c Merge all the copies of _tcb_ctor and _tcb_dtor. 2015-01-21 16:41:05 +00:00
thr_detach.c
thr_equal.c
thr_event.c
thr_exit.c Revert r274772: it is not valid on MIPS 2014-11-25 03:50:31 +00:00
thr_fork.c Lock pshared_lock shared around fork, to ensure that the COW snapshot 2016-03-21 06:52:35 +00:00
thr_getcpuclockid.c
thr_getprio.c
thr_getschedparam.c
thr_getthreadid_np.c
thr_info.c
thr_init.c Lock pshared_lock shared around fork, to ensure that the COW snapshot 2016-03-21 06:52:35 +00:00
thr_join.c
thr_kern.c
thr_kill.c In _pthread_kill(), if passed pthread is current thread, do not send 2014-02-01 18:13:18 +00:00
thr_list.c
thr_main_np.c
thr_multi_np.c
thr_mutex.c Apparently there are some popular programs around which assume that it 2016-03-22 10:51:42 +00:00
thr_mutexattr.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_once.c Style. Use ANSI definition, wrap long lines, no initialization in 2015-09-08 08:48:53 +00:00
thr_printf.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
thr_private.h Apparently there are some popular programs around which assume that it 2016-03-22 10:51:42 +00:00
thr_pshared.c Lock pshared_lock shared around fork, to ensure that the COW snapshot 2016-03-21 06:52:35 +00:00
thr_pspinlock.c Implement process-shared spinlocks. 2016-03-21 06:40:54 +00:00
thr_resume_np.c
thr_rtld.c From libthr, remove special and strange code to set up session and 2016-03-21 06:46:16 +00:00
thr_rwlock.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_rwlockattr.c Implement process-shared locks support for libthr.so.3, without 2016-02-28 17:52:33 +00:00
thr_self.c
thr_sem.c
thr_setprio.c
thr_setschedparam.c
thr_sig.c Pre-resolve symbols required for the deferred signal processing. This 2015-08-10 17:02:42 +00:00
thr_single_np.c
thr_sleepq.c
thr_spec.c Some third-party malloc(3) implementations use pthread_setspecific(3) 2015-05-15 08:40:17 +00:00
thr_spinlock.c Properly interpose libc spinlocks, was missed in r276630. In 2015-02-14 11:47:40 +00:00
thr_stack.c If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbols 2016-02-08 19:24:13 +00:00
thr_suspend_np.c
thr_switch_np.c
thr_symbols.c
thr_syscalls.c If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbols 2016-02-08 19:24:13 +00:00
thr_umtx.c libthr: const-ify two variables 2016-01-13 22:34:55 +00:00
thr_umtx.h libthr: Fix a parameter name in an internal header file. 2013-04-27 14:21:36 +00:00
thr_yield.c