freebsd-dev/lib/libthr
Ryan Stone aad93b043a r179417 introduced a bug into pthread_once(). Previously pthread_once()
used a global pthread_mutex_t for synchronization.  r179417 replaced that
with an implementation that directly used atomic instructions and thr_*
syscalls to synchronize callers to pthread_once.  However, calling
pthread_mutex_lock on the global mutex implicitly ensured that
_thr_check_init() had been called but with r179417 this was no longer
guaranteed.  This meant that if you were unlucky enough to have your first
call into libthr be a call to pthread_once(), you would segfault when
trying to access the pointer returned by _get_curthread().

The fix is to explicitly call _thr_check_init() from pthread_once().

Reviewed by:	davidxu
Approved by:	emaste (mentor)
MFC after:	1 week
2011-04-20 14:19:34 +00:00
..
arch Add section .note.GNU-stack for assembly files used by 386 and amd64. 2011-01-07 16:09:33 +00:00
support Merge from tbemd, with a small amount of rework: 2010-09-13 01:43:10 +00:00
sys __error could be called too early before libthr is initialized, test 2006-07-12 03:44:05 +00:00
thread r179417 introduced a bug into pthread_once(). Previously pthread_once() 2011-04-20 14:19:34 +00:00
libthr.3 mdoc: order prologue macros consistently by Dd/Dt/Os 2010-04-14 19:08:06 +00:00
Makefile Oops, don't remove -fexceptions flag. 2010-10-08 01:53:33 +00:00
pthread.map Introduce a non-portable function pthread_getthreadid_np(3) to retrieve 2011-02-07 21:26:46 +00:00