aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-05 17:15:57 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-05 17:19:32 +0200
commitce0b7961ae400e5aeff28d54dc14955199947b74 (patch)
tree3e7acb0eb6915c2c3af747dd9d982d4dc3418b78 /sysdeps/nptl
parent0197c1bc604e1d6357cfa07a75ab73bababa7f0f (diff)
downloadglibc-ce0b7961ae400e5aeff28d54dc14955199947b74.tar
glibc-ce0b7961ae400e5aeff28d54dc14955199947b74.tar.gz
glibc-ce0b7961ae400e5aeff28d54dc14955199947b74.tar.bz2
glibc-ce0b7961ae400e5aeff28d54dc14955199947b74.zip
nptl: Consolidate async cancel enable/disable implementation in libc
Previously, the source file nptl/cancellation.c was compiled multiple times, for libc, libpthread, librt. This commit switches to a single implementation, with new __pthread_enable_asynccancel@@GLIBC_PRIVATE, __pthread_disable_asynccancel@@GLIBC_PRIVATE exports. The almost-unused CANCEL_ASYNC and CANCEL_RESET macros are replaced by LIBC_CANCEL_ASYNC and LIBC_CANCEL_ASYNC macros. They call the __pthread_* functions unconditionally now. The macros are still needed because shared code uses them; Hurd has different definitions. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl')
-rw-r--r--sysdeps/nptl/Makefile3
-rw-r--r--sysdeps/nptl/librt-cancellation.c24
-rw-r--r--sysdeps/nptl/lowlevellock-futex.h8
3 files changed, 5 insertions, 30 deletions
diff --git a/sysdeps/nptl/Makefile b/sysdeps/nptl/Makefile
index adcced422b..632cd3686b 100644
--- a/sysdeps/nptl/Makefile
+++ b/sysdeps/nptl/Makefile
@@ -21,8 +21,7 @@ libpthread-sysdep_routines += errno-loc
endif
ifeq ($(subdir),rt)
-librt-sysdep_routines += timer_routines librt-cancellation
-CFLAGS-librt-cancellation.c += -fexceptions -fasynchronous-unwind-tables
+librt-sysdep_routines += timer_routines
tests += tst-mqueue8x
CFLAGS-tst-mqueue8x.c += -fexceptions
diff --git a/sysdeps/nptl/librt-cancellation.c b/sysdeps/nptl/librt-cancellation.c
deleted file mode 100644
index 1ad0eb11ff..0000000000
--- a/sysdeps/nptl/librt-cancellation.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <nptl/pthreadP.h>
-
-
-#define __pthread_enable_asynccancel __librt_enable_asynccancel
-#define __pthread_disable_asynccancel __librt_disable_asynccancel
-#include <nptl/cancellation.c>
diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
index ca96397a4a..66ebfe50f4 100644
--- a/sysdeps/nptl/lowlevellock-futex.h
+++ b/sysdeps/nptl/lowlevellock-futex.h
@@ -121,18 +121,18 @@
/* Like lll_futex_wait, but acting as a cancellable entrypoint. */
# define lll_futex_wait_cancel(futexp, val, private) \
({ \
- int __oldtype = CANCEL_ASYNC (); \
+ int __oldtype = LIBC_CANCEL_ASYNC (); \
long int __err = lll_futex_wait (futexp, val, LLL_SHARED); \
- CANCEL_RESET (__oldtype); \
+ LIBC_CANCEL_RESET (__oldtype); \
__err; \
})
/* Like lll_futex_timed_wait, but acting as a cancellable entrypoint. */
# define lll_futex_timed_wait_cancel(futexp, val, timeout, private) \
({ \
- int __oldtype = CANCEL_ASYNC (); \
+ int __oldtype = LIBC_CANCEL_ASYNC (); \
long int __err = lll_futex_timed_wait (futexp, val, timeout, private); \
- CANCEL_RESET (__oldtype); \
+ LIBC_CANCEL_RESET (__oldtype); \
__err; \
})