>From 6b4c64f06648b95f942d5428991979b9d8f2c69b Mon Sep 17 00:00:00 2001 From: Bruno Haible
Date: Thu, 20 Jun 2019 04:30:11 +0200 Subject: [PATCH 19/26] mtx: New module. * lib/mtx.c: New file. * modules/mtx: New file. * doc/posix-functions/call_once.texi: Mention the new module. * doc/posix-functions/mtx_init.texi: Likewise. * doc/posix-functions/mtx_lock.texi: Likewise. * doc/posix-functions/mtx_trylock.texi: Likewise. * doc/posix-functions/mtx_timedlock.texi: Likewise. * doc/posix-functions/mtx_unlock.texi: Likewise. * doc/posix-functions/mtx_destroy.texi: Likewise. --- ChangeLog | 13 ++ doc/posix-functions/call_once.texi | 8 +- doc/posix-functions/mtx_destroy.texi | 8 +- doc/posix-functions/mtx_init.texi | 8 +- doc/posix-functions/mtx_lock.texi | 8 +- doc/posix-functions/mtx_timedlock.texi | 8 +- doc/posix-functions/mtx_trylock.texi | 8 +- doc/posix-functions/mtx_unlock.texi | 8 +- lib/mtx.c | 288 +++++++++++++++++++++++++++++++++ modules/mtx | 34 ++++ 10 files changed, 363 insertions(+), 28 deletions(-) create mode 100644 lib/mtx.c create mode 100644 modules/mtx diff --git a/ChangeLog b/ChangeLog index 5d96988..0e73bd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2019-06-20 Bruno Haible + mtx: New module. + * lib/mtx.c: New file. + * modules/mtx: New file. + * doc/posix-functions/call_once.texi: Mention the new module. + * doc/posix-functions/mtx_init.texi: Likewise. + * doc/posix-functions/mtx_lock.texi: Likewise. + * doc/posix-functions/mtx_trylock.texi: Likewise. + * doc/posix-functions/mtx_timedlock.texi: Likewise. + * doc/posix-functions/mtx_unlock.texi: Likewise. + * doc/posix-functions/mtx_destroy.texi: Likewise. + +2019-06-20 Bruno Haible + thrd: New module. * lib/thrd.c: New file. * m4/thrd.m4: New file. diff --git a/doc/posix-functions/call_once.texi b/doc/posix-functions/call_once.texi index c3b10fb..84b9dfe 100644 --- a/doc/posix-functions/call_once.texi +++ b/doc/posix-functions/call_once.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/Call-Once.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/doc/posix-functions/mtx_destroy.texi b/doc/posix-functions/mtx_destroy.texi index ec8fe87..fda5048 100644 --- a/doc/posix-functions/mtx_destroy.texi +++ b/doc/posix-functions/mtx_destroy.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/doc/posix-functions/mtx_init.texi b/doc/posix-functions/mtx_init.texi index 867f6a2..297ad34 100644 --- a/doc/posix-functions/mtx_init.texi +++ b/doc/posix-functions/mtx_init.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/doc/posix-functions/mtx_lock.texi b/doc/posix-functions/mtx_lock.texi index 8e43992..958589d 100644 --- a/doc/posix-functions/mtx_lock.texi +++ b/doc/posix-functions/mtx_lock.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/doc/posix-functions/mtx_timedlock.texi b/doc/posix-functions/mtx_timedlock.texi index 31e766e..d42f1ae 100644 --- a/doc/posix-functions/mtx_timedlock.texi +++ b/doc/posix-functions/mtx_timedlock.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/doc/posix-functions/mtx_trylock.texi b/doc/posix-functions/mtx_trylock.texi index 26c38d6..e5beb64 100644 --- a/doc/posix-functions/mtx_trylock.texi +++ b/doc/posix-functions/mtx_trylock.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/doc/posix-functions/mtx_unlock.texi b/doc/posix-functions/mtx_unlock.texi index e7779d8..f77ea17 100644 --- a/doc/posix-functions/mtx_unlock.texi +++ b/doc/posix-functions/mtx_unlock.texi @@ -10,15 +10,15 @@ Documentation:@* @url{https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html}. @end ifnotinfo -Gnulib module: --- +Gnulib module: mtx Portability problems fixed by Gnulib: @itemize +@item +This function is missing on many platforms: +glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize Portability problems not fixed by Gnulib: @itemize -@item -This function is missing on many platforms: -glibc 2.27, Mac OS X 10.5, FreeBSD 9.3, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 7.1, HP-UX 11.31, IRIX 6.5, OSF/1 5.1, Solaris 11.3, Cygwin, mingw, MSVC 14, Interix 3.5, BeOS, Android 9.0. @end itemize diff --git a/lib/mtx.c b/lib/mtx.c new file mode 100644 index 0000000..6acb8ae --- /dev/null +++ b/lib/mtx.c @@ -0,0 +1,288 @@ +/* ISO C 11 locking in multithreaded situations. + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see