aboutsummaryrefslogtreecommitdiff
path: root/lib/libthr/thread
Commit message (Collapse)AuthorAgeFilesLines
* Ensure that threading library is initialized in pthread_mutex_init().Konstantin Belousov2020-11-301-0/+2
| | | | | | | | | | | | We need at least thr_malloc ready. The situation is possible e.g. in case of libthr being listed in DT_NEEDED before some of its consumers. Reported and tested by: lev Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=368190
* libc: Add pthread_attr_get_np(3) stub, reporting ESRCH.Konstantin Belousov2020-11-281-0/+1
| | | | | | | | | | | | | | | This seems to be required by recent clang asan. I do not see other way than put the symbol under FBSD_1.0 version. PR: 251112 Reported by: Andrew Stitcher <astitcher@apache.org> Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27389 Notes: svn path=/head/; revision=368125
* Style.Konstantin Belousov2020-11-261-18/+18
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=368082
* Add pthread_getname_np() and pthread_setname_np() aliases forKonstantin Belousov2020-06-101-17/+59
| | | | | | | | | | | | | | | pthread_get_name_np() and pthread_set_name_np(). This re-applies r361770 after compatibility fixes. Reviewed by: antoine, jkim, markj Tested by: antoine (exp-run) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25117 Notes: svn path=/head/; revision=362032
* Revert r361770 "Add pthread_getname_np() and pthread_setname_np() aliases" ↵Konstantin Belousov2020-06-041-2/+0
| | | | | | | | | | | | for now. It is not compatible enough with Linux. Requested by: antoine, jkim Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=361784
* Add pthread_getname_np() and pthread_setname_np() aliasesKonstantin Belousov2020-06-031-0/+2
| | | | | | | | | | | | | | for pthread_get_name_np() and pthread_set_name_np(), to be compatible with Linux. PR: 238404 Proposed and reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25117 Notes: svn path=/head/; revision=361770
* Add pthread_peekjoin_np(3).Konstantin Belousov2020-02-151-7/+26
| | | | | | | | | | | | | | The function allows to peek at the thread exit status and even see return value, without joining (and thus finally destroying) the target thread. Reviewed by: markj Sponsored by: The FreeBSD Foundation (kib) MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D23676 Notes: svn path=/head/; revision=357985
* Return success, instead of ESRCH, from pthread_cancel(3) applied to theKonstantin Belousov2020-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | exited but not yet joined thread. Before, if the thread exited but was not yet joined, we returned ESRCH. According to IEEE Std 1003.1™-2017 recommendation in the description of pthread_cancel(3): If an implementation detects use of a thread ID after the end of its lifetime, it is recommended that the function should fail and report an [ESRCH] error. So it seems desirable to not return ESRCH until the lifetime of the thread ID ends. According to the section 2.9.2 Thread IDs, The lifetime of a thread ID ends after the thread terminates if it was created with the detachstate attribute set to PTHREAD_CREATE_DETACHED or if pthread_detach() or pthread_join() has been called for that thread. In other words, lifetime for thread ID of exited but not yet joined thread did not ended yet. Prompted by: cperciva Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=357894
* Use sigfastblock(2) for masking signals in libthr.Konstantin Belousov2020-02-094-6/+69
| | | | | | | | | | | | | | | | | Ensure proper handshake to transfer sigfastblock(2) blocking word ownership from rtld to libthr. Unfortunately sigfastblock(2) is not enough to stop intercepting signals in libthr, because critical sections must ensure more than just signal blocking. Tested by: pho Disscussed with: cem, emaste, jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D12773 Notes: svn path=/head/; revision=357698
* Fix destruction of the robust mutexes.Konstantin Belousov2019-09-231-1/+5
| | | | | | | | | | | | | | | If robust mutex' owner terminated, causing kernel-assisted state recovery, and then pthread_mutex_destroy() is executed as the next action, assert is triggered about mutex still being on the list. Ignore the mutex linkage in pthread_mutex_destroy() for shared robust mutexes with dead owner, same as for enqueue_mutex(). Reported by: avg Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=352620
* Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.Konstantin Belousov2019-08-213-4/+8
| | | | | | | | | | PR: 240022 Reported by: Andrew Gierth <andrew@tao11.riddles.org.uk> Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=351349
* Avoid conflicts with libc symbols in libthr jump table.Konstantin Belousov2019-07-311-2/+0
| | | | | | | | | | | | | | | | | | | In some corner cases of static linking and unexpected libraries order on the linker command line, libc symbol might preempt the same libthr symbol, in which case libthr jump table points back to libc causing either infinite recursion or loop. Handle all of such symbols by using private libthr names for them, ensuring that the right pointers are installed into the table. In collaboration with: arichardson PR: 239475 Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21088 Notes: svn path=/head/; revision=350483
* Avoid conflicts with libc symbols in libthr jump table.Konstantin Belousov2019-07-3121-216/+353
| | | | | | | | | | | | | | | | | | | In some corner cases of static linking and unexpected libraries order on the linker command line, libc symbol might preempt the same libthr symbol, in which case libthr jump table points back to libc causing either infinite recursion or loop. Handle all of such symbols by using private libthr names for them, ensuring that the right pointers are installed into the table. In collaboration with: arichardson PR: 239475 Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21088 Notes: svn path=/head/; revision=350481
* Restore ability to pass NULL name argument to pthread_set_name_np(3)Konstantin Belousov2019-07-111-1/+1
| | | | | | | | | | | to clear the thread name. PR: 239142 Submitted by: Lewis Donzis <lew@perftech.com> MFC after: 3 days Notes: svn path=/head/; revision=349912
* Add libc stub for pthread_getthreadid_np(3).Konstantin Belousov2019-06-231-0/+1
| | | | | | | | | | Requested by: jbeich PR: 238650 Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=349299
* Do not access mutex memory after unlock.Konstantin Belousov2019-04-121-2/+3
| | | | | | | | | | PR: 237195 Reported by: freebsd@hurrikhan.eu Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=346158
* Fix initial exec TLS mode for dynamically loaded shared objects.Konstantin Belousov2019-03-292-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | If dso uses initial exec TLS mode, rtld tries to allocate TLS in static space. If there is no space left, the dlopen(3) fails. If space if allocated, initial content from PT_TLS segment is distributed to all threads' pcbs, which was missed and caused un-initialized TLS segment for such dso after dlopen(3). The mode is auto-detected either due to the relocation used, or if the DF_STATIC_TLS dynamic flag is set. In the later case, the TLS segment is tried to allocate earlier, which increases chance of the dlopen(3) to succeed. LLD was recently fixed to properly emit the flag, ld.bdf did it always. Initial test by: dumbbell Tested by: emaste (amd64), ian (arm) Tested by: Gerald Aryeetey <aryeeteygerald_rogers.com> (arm64) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D19072 Notes: svn path=/head/; revision=345703
* Have pthread_cond_destroy() return EBUSY if the condvar has waiters.Mark Johnston2019-03-081-5/+14
| | | | | | | | | | | | | | | | This is not required of a compliant implementation, but it's easy to check for and helps improve compatibility with other common implementations. Moreover, it's consistent with our pthread_mutex_destroy(). PR: 234805 Reviewed by: jhb, kib, ngie MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19496 Notes: svn path=/head/; revision=344935
* Fixes for very early use of the pthread_mutex_* and libthr malloc.Konstantin Belousov2019-02-042-0/+7
| | | | | | | | | | | | | | | | | | | | | When libthr is statically linked into the binary, order of the constructors execution is not deterministic. It is possible for the application constructor to use pthread_mutex_* functions before the libthr initialization was done. Handle it by: - making thr_malloc.c locking functions operational when curthread is not yet set; - making __thr_malloc_init() idempotent, allowing more than one call to it; - unconditionally calling __thr_malloc_init() before initializing a process-private mutex. Reported and tested by: mmel Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=343754
* Untangle jemalloc and mutexes initialization.Konstantin Belousov2019-01-297-10/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The need to use libc malloc(3) from some places in libthr always caused issues. For instance, per-thread key allocation was switched to use plain mmap(2) to get storage, because some third party mallocs used keys for implementation of calloc(3). Even more important, libthr calls calloc(3) during initialization of pthread mutexes, and jemalloc uses pthread mutexes. Jemalloc provides some way to both postpone the initialization, and to make initialization to use specialized allocator, but this is very fragile and often breaks. See the referenced PR for another example. Add the small malloc implementation used by rtld, to libthr. Use it in thr_spec.c and for mutexes initialization. This avoids the issues with mutual dependencies between malloc and libthr in principle. The drawback is that some more allocations are not interceptable for alternate malloc implementations. There should be not too much memory use from this allocator, and the alternative, direct use of mmap(2) is obviously worse. PR: 235211 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18988 Notes: svn path=/head/; revision=343566
* Remove declarations of syscalls not used in libthr.Brooks Davis2018-12-031-6/+0
| | | | | | | | Reviewed by: kib Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=341445
* Use _thr_isthreaded() and _thr_setthreaded() wrappersEric van Gyzen2018-11-302-4/+4
| | | | | | | | | | ...instead of directly using the global variable. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=341278
* _thr_setthreaded() cannot fail; change return type to voidEric van Gyzen2018-11-303-8/+3
| | | | | | | | | | | | Also remove logic to avoid unnecessary stores to the global variable. Thread creation and destruction are heavy enough that any supposed savings is in the noise. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=341277
* Make libthr(3) use sysconf(_SC_NPROCESSORS_CONF); this shaves offEdward Tomasz Napierala2018-11-191-2/+3
| | | | | | | | | | | | two calls to sysctl(2) from the binary startup. Reviewed by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18046 Notes: svn path=/head/; revision=340642
* libthr: minor spacing cleanup.Pedro F. Giffuni2018-08-211-2/+2
| | | | | | | | | No functional change. X-MFC with: r337992 Notes: svn path=/head/; revision=338125
* POSIX compliance improvements in the pthread(3) functions.Pedro F. Giffuni2018-08-1811-44/+61
| | | | | | | | | | | | | | | | This basically adds makes use of the C99 restrict keyword, and also adds some 'const's to four threading functions: pthread_mutexattr_gettype(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_getprotocol(), and pthread_mutex_getprioceiling. The changes are in accordance to POSIX/SUSv4-2018. Hinted by: DragonFlyBSD Relnotes: yes MFC after: 1 month Differential Revision: D16722 Notes: svn path=/head/; revision=337992
* Add pthread_get_name_np(3).Konstantin Belousov2018-08-173-11/+58
| | | | | | | | | | | | | | | | The function retrieves the thread name previously set by pthread_set_name_np(3). The name is cached in the process memory. Requested by: Willem Jan Withagen <wjw@digiware.nl> Man page update: Yuri Pankov <yuripv@yuripv.net> Reviewed by: ian (previous version) Discussed with: arichardson, bjk (man page) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D16702 Notes: svn path=/head/; revision=337983
* Ensure thread library is initialized in pthread_testcancel().John Baldwin2018-03-211-1/+3
| | | | | | | | | | | | | | | | | | | | Call _thr_check_init() before reading curthread in pthread_testcancel(). If a constructor in a library creates a semaphore via sem_init() and then waits for it via sem_wait(), the program can core dump in _pthread_testcancel() called from sem_wait(). This is because the semaphore implementation lives in libc, so the library's constructors can be run before libthr's constructors. Reported by: arichardson Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14786 Notes: svn path=/head/; revision=331324
* libthr: Fix missing break in switch.Pedro F. Giffuni2018-01-271-0/+1
| | | | | | | | | | This is also a warning in recent GCC with -Wimplicit-fallthrough. CID: 1356262 Obtained from: DragonFly (git 0f037c78 - partial) Notes: svn path=/head/; revision=328493
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2627-21/+75
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2020-20/+61
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-188-8/+24
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* [libthr] revert change of visibility of _thread_keytable to unbreak debuggerMichael Zhilin2017-10-022-1/+4
| | | | | | | | | | | | | | | | Fix regression by r318539. The sysutils/pstack uses library libthread_db to read information about threads state. The function pt_ta_new makes lookup of several key symbols including _thread_keytable. But r318539 mades this field static. It causes silent ignore of libthr library by pstack and as result sysutils/pstack doesn't output any thread information. This fix changes this field back to non-static. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11738 Notes: svn path=/head/; revision=324219
* libthr: check for possible overflow in the pthread_barrier_init() count.Pedro F. Giffuni2017-07-151-1/+1
| | | | | | | | | | | | | Following up on r320900, where the check for negative count values was removed, add a check to prevent integer overflow. This is to account that b_count, b_waiters but most importantly the total number of threads in the system are signed values. Discussed with: kib MFC after: 2 weeks Notes: svn path=/head/; revision=321011
* libthr: 'count' is unsigned so don't check for negative values.Pedro F. Giffuni2017-07-141-1/+1
| | | | | | | Obtained from: DragonFlyBSD (git e7db8139) Notes: svn path=/head/; revision=320990
* libthr: fix warnings at WARNS=6Eric van Gyzen2017-05-261-1/+3
| | | | | | | | | | | | Fix more warnings about redundant declarations. Reviewed by: kib emaste MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10932 Notes: svn path=/head/; revision=318955
* libthr: fix style in previous commitEric van Gyzen2017-05-261-1/+1
| | | | | | | | | | | I intended to add this to the previous commit. Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Notes: svn path=/head/; revision=318953
* libthr: prevent setcontext() from masking SIGTHREric van Gyzen2017-05-261-1/+1
| | | | | | | | | | | | | | | | | __thr_setcontext() mistakenly tested for the presence of SIGCANCEL in its local ucontext_t instead of the parameter. Therefore, if a thread calls setcontext() with a context whose signal mask contains SIGTHR (a.k.a. SIGCANCEL), that signal will be blocked, preventing the thread from being cancelled or suspended. Reported by: gcc 6.1 via RISC-V tinderbox Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10933 Notes: svn path=/head/; revision=318952
* libthr: fix warnings from GCC when WARNS=6Eric van Gyzen2017-05-235-20/+32
| | | | | | | | | | | | | | | | | | | Fix warnings about: - redundant declarations - a local variable shadowing a global function (dlinfo) - an old-style function definition (with an empty parameter list) - a variable that is possibly used uninitialized "make tinderbox" passes this time, except for a few unrelated kernel failures. Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10870 Notes: svn path=/head/; revision=318749
* libthr: Use CLI flags instead of pragmas to disable warningsEric van Gyzen2017-05-202-21/+0
| | | | | | | | | | | | | | | | | | People tweaking the build system or compilers tend to look into the Makefile and not into the source. Having some warning controls in the Makefile and some in the source code is surprising. Pragmas have the advantage that they leave the warnings enabled for more code, but that advantage isn't very relevant in these cases. Requested by: kib Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10832 Notes: svn path=/head/; revision=318584
* Remove old spinlock_debug code from libcEric van Gyzen2017-05-202-7/+6
| | | | | | | | | | | | | | | This no longer seems useful. Remove it. This was prompted by a "cast discards volatile qualifier" warning in libthr when WARNS=6. Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10832 Notes: svn path=/head/; revision=318582
* libthr: change CHECK_AND_INIT_RWLOCK to an inline functionEric van Gyzen2017-05-201-24/+47
| | | | | | | | | | | | | This was prompted by a compiler warning about 'ret' shadowing a local variable in the callers of the macro. Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10832 Notes: svn path=/head/; revision=318581
* libthr: fix warnings at WARNS=6Eric van Gyzen2017-05-198-11/+33
| | | | | | | | | | | | | | | | | | | Fix warnings about the following when WARNS=6 (which I will commit soon): - casting away const - no previous 'extern' declaration for non-static variable - others as explained by #pragmas and comments - unused parameters The last is the only functional change. Reviewed by: kib MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10808 Notes: svn path=/head/; revision=318539
* Fix __pthread_mutex_trylock() to call THR_CRITICAL_LEAVE() on failure ratherJason Evans2017-05-131-1/+1
| | | | | | | | | | than on success. This regression was introduced by r300043 (Add implementation of robust mutexes...). MFC after: 1 day Notes: svn path=/head/; revision=318254
* Add clock_nanosleep()Eric van Gyzen2017-03-192-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Add a clock_nanosleep() syscall, as specified by POSIX. Make nanosleep() a wrapper around it. Attach the clock_nanosleep test from NetBSD. Adjust it for the FreeBSD behavior of updating rmtp only when interrupted by a signal. I believe this to be POSIX-compliant, since POSIX mentions the rmtp parameter only in the paragraph about EINTR. This is also what Linux does. (NetBSD updates rmtp unconditionally.) Copy the whole nanosleep.2 man page from NetBSD because it is complete and closely resembles the POSIX description. Edit, polish, and reword it a bit, being sure to keep any relevant text from the FreeBSD page. Reviewed by: kib, ngie, jilles MFC after: 3 weeks Relnotes: yes Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10020 Notes: svn path=/head/; revision=315526
* Make use of clang nullability attributes.Pedro F. Giffuni2017-01-281-5/+7
| | | | | | | | | | | | | | | | | | Replace uses of the GCC __nonnull__ attribute with the clang nullability qualifiers. The replacement should be transparent for clang developers as the new qualifiers will produce the same warnings and will be useful for static checkers but will not cause aggressive optimizations. GCC will not produce such warnings and developers will have to use upgraded GCC ports built with the system headers from r312538. Hinted by: Apple's Libc-1158.20.4, Bionic libc MFC after: 11.1 Release Differential Revision: https://reviews.freebsd.org/D9004 Notes: svn path=/head/; revision=312934
* libthr: coalesce repeated #if blocksEd Maste2017-01-251-3/+0
| | | | Notes: svn path=/head/; revision=312774
* Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).Konstantin Belousov2016-12-061-2/+12
| | | | | | | | | | | | | | | Leave robust-protected region before checking for cancellation by calling _thr_testcancel(). Otherwise, if cancelling request was pending, the cancel handler is called with the dandling inact_mtx, which triggers an assert if any mutex operation is performed by the handler. Reported and tested by: Dimitri Staessens <dimitri.staessens@intec.ugent.be> Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=309630
* The fdatasync(2) call must be cancellation point.Konstantin Belousov2016-08-161-0/+15
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 13 days Notes: svn path=/head/; revision=304209
* Add __cxa_thread_atexit(3) API implementation.Konstantin Belousov2016-08-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the backing feature to implement C++11 thread storage duration specified by the thread_local keyword. A destructor for given thread-local object is registered to be executed at the thread termination time using __cxa_thread_atexit(). Libc calls the __cxa_thread_calls_dtors() during exit(3), before finalizers and atexit functions, and libthr calls the function at the thread termination time, after the stack unwinding and thread-specific key destruction. There are several uncertainties in the API which lacks a formal specification. Among them: - is it allowed to register destructors during destructing; we allow, but limiting the nesting level. If too many iterations detected, a diagnostic is issued to stderr and thread forcibly terminates for now. - how to handle destructors which belong to an unloading dso; for now, we ignore destructor calls for such entries, and issue a diagnostic. Linux does prevent dso unload until all threads with destructors from the dso terminated. It is supposed that the diagnostics allow to detect real-world applications relying on the above details and possibly adjust our implementation. Right now the choices were to provide the slim API (but that rarely stands the practice test). Tests are added to check generic functionality and to specify some of the above implementation choices. Submitted by: Mahdi Mokhtari <mokhi64_gmail.com> Reviewed by: theraven Discussed with: dim (detection of -std=c++11 supoort for tests) Sponsored by: The FreeBSD Foundation (my involvement) MFC after: 2 weeks Differential revisions: https://reviews.freebsd.org/D7224, https://reviews.freebsd.org/D7427 Notes: svn path=/head/; revision=303795