History log of /freebsd-10-stable/lib/libthr/thread/thr_once.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 303709 03-Aug-2016 kib

MFC r303393:
Remove empty initializer for the once facility.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 220888 20-Apr-2011 rstone

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


# 179417 29-May-2008 davidxu

Eliminate global mutex by using pthread_once's state field as
a semaphore.


# 172695 16-Oct-2007 davidxu

Use macro THR_CLEANUP_PUSH/POP, they are cheaper than pthread_cleanup_push/pop.


# 155739 15-Feb-2006 davidxu

Rework last change of pthread_once, create a function _thr_once_init to
reinitialize its internal locks.


# 155714 15-Feb-2006 davidxu

After fork(), reinitialize internal locks for pthread_once().


# 153496 17-Dec-2005 davidxu

Update copyright.


# 144518 01-Apr-2005 davidxu

Import my recent 1:1 threading working. some features improved includes:
1. fast simple type mutex.
2. __thread tls works.
3. asynchronous cancellation works ( using signal ).
4. thread synchronization is fully based on umtx, mainly, condition
variable and other synchronization objects were rewritten by using
umtx directly. those objects can be shared between processes via
shared memory, it has to change ABI which does not happen yet.
5. default stack size is increased to 1M on 32 bits platform, 2M for
64 bits platform.
As the result, some mysql super-smack benchmarks show performance is
improved massivly.

Okayed by: jeff, mtm, rwatson, scottl


# 112918 01-Apr-2003 jeff

- Add libthr but don't hook it up to the regular build yet. This is an
adaptation of libc_r for the thr system call interface. This is beta
quality code.