1 | /* Copyright (C) 2002-2021 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. |
3 | Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #include <shlib-compat.h> |
20 | |
21 | #if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) |
22 | # include "pthreadP.h" |
23 | # include <libc-lock.h> |
24 | |
25 | void attribute_compat_text_section |
26 | _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, |
27 | void (*routine) (void *), void *arg) |
28 | { |
29 | buffer->__routine = routine; |
30 | buffer->__arg = arg; |
31 | __libc_cleanup_push_defer (buffer); |
32 | } |
33 | compat_symbol (libpthread, _pthread_cleanup_push_defer, |
34 | _pthread_cleanup_push_defer, GLIBC_2_0); |
35 | |
36 | void attribute_compat_text_section |
37 | _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, |
38 | int execute) |
39 | { |
40 | __libc_cleanup_pop_restore (buffer); |
41 | |
42 | /* If necessary call the cleanup routine after we removed the |
43 | current cleanup block from the list. */ |
44 | if (execute) |
45 | buffer->__routine (buffer->__arg); |
46 | } |
47 | compat_symbol (libpthread, _pthread_cleanup_pop_restore, |
48 | _pthread_cleanup_pop_restore, GLIBC_2_0); |
49 | |
50 | #endif /* OTHER_SHLIB_COMPAT */ |
51 | |