Commit Graph

16 Commits

Author SHA1 Message Date
Konstantin Belousov
2a339d9e3d Add implementation of robust mutexes, hopefully close enough to the
intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013.

A robust mutex is guaranteed to be cleared by the system upon either
thread or process owner termination while the mutex is held.  The next
mutex locker is then notified about inconsistent mutex state and can
execute (or abandon) corrective actions.

The patch mostly consists of small changes here and there, adding
neccessary checks for the inconsistent and abandoned conditions into
existing paths.  Additionally, the thread exit handler was extended to
iterate over the userspace-maintained list of owned robust mutexes,
unlocking and marking as terminated each of them.

The list of owned robust mutexes cannot be maintained atomically
synchronous with the mutex lock state (it is possible in kernel, but
is too expensive).  Instead, for the duration of lock or unlock
operation, the current mutex is remembered in a special slot that is
also checked by the kernel at thread termination.

Kernel must be aware about the per-thread location of the heads of
robust mutex lists and the current active mutex slot.  When a thread
touches a robust mutex for the first time, a new umtx op syscall is
issued which informs about location of lists heads.

The umtx sleep queues for PP and PI mutexes are split between
non-robust and robust.

Somewhat unrelated changes in the patch:
1. Style.
2. The fix for proper tdfind() call use in umtxq_sleep_pi() for shared
   pi mutexes.
3. Removal of the userspace struct pthread_mutex m_owner field.
4. The sysctl kern.ipc.umtx_vnode_persistent is added, which controls
   the lifetime of the shared mutex associated with a vnode' page.

Reviewed by:	jilles (previous version, supposedly the objection was fixed)
Discussed with:	brooks, Martin Simmons <martin@lispworks.com> (some aspects)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2016-05-17 09:56:22 +00:00
Ruslan Ermilov
3e9ed1efb8 Hide the implementation details about multiple threading libraries
from the synopses of pthread*(3) manpages.

Reviewed by:	deischen, davidxu
2007-10-22 10:08:01 +00:00
Ruslan Ermilov
5bb9f2101b Remove mentions of libc_r. 2006-09-30 11:22:26 +00:00
Ruslan Ermilov
f9f9d2e804 Document interfaces that are supported by libthr. 2004-01-15 15:59:00 +00:00
Ruslan Ermilov
ec7452f103 Have a single set of POSIX threads man pages. The LIBRARY section
of each manpage lists libraries that have corresponding interfaces
implemented.

Prodded by:	threads
Reviewed by:	deischen
2004-01-14 21:44:26 +00:00
Philippe Charnier
9d09157a0f The .Fn function. Use .Xr where appropriate. 2003-03-24 16:05:24 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov
a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Dima Dorfman
70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Ruslan Ermilov
096841eceb Use ``.St -p1003.1-96''. 2001-02-26 15:16:43 +00:00
Alexey Zelkin
d8a7868820 Introduce .Lb macro to libc_r manpages. 2000-04-22 15:50:29 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Nik Clayton
fbc400a67a Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:50:10 +00:00
Wolfram Schneider
acd8019083 Sort cross references. 1998-08-31 16:41:09 +00:00
Alexander Langer
8ac3b85e63 The pthreads standard has been published. Change:
...is expected to conform to IEEE (``POSIX'') Std 1003.1c when it is
   published.
to:
   ...conforms to ISO/IEC 9945-1 ANSI/IEEE (``POSIX'') Std 1003.1 Second
   Edition 1996-07-12.

Discussed with:	jb
1998-08-03 00:58:37 +00:00
Poul-Henning Kamp
1fbdc08dfe I've put together man pages for the pthread_cleanup, pthread_cond, and
pthread_mutex routines. I've also tweaked pthread_create.3 to point to
pthread_cleanup_push(3) and pthread_cleanup_pop(3).

PR:		7450
Submitted by:	Brian Cully <shmit@kublai.com>
1998-07-31 09:09:19 +00:00