benchtests: Use JSON for bench-rawmemchr output
[glibc.git] / nptl / cleanup_defer_compat.c
blob238eb46ee4dceeca254ceaf977c548d576bd7d9c
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.
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.
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.
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/>. */
19 #include <shlib-compat.h>
21 #if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
22 # include "pthreadP.h"
23 # include <libc-lock.h>
25 void attribute_compat_text_section
26 _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
27 void (*routine) (void *), void *arg)
29 buffer->__routine = routine;
30 buffer->__arg = arg;
31 __libc_cleanup_push_defer (buffer);
33 compat_symbol (libpthread, _pthread_cleanup_push_defer,
34 _pthread_cleanup_push_defer, GLIBC_2_0);
36 void attribute_compat_text_section
37 _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
38 int execute)
40 __libc_cleanup_pop_restore (buffer);
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);
47 compat_symbol (libpthread, _pthread_cleanup_pop_restore,
48 _pthread_cleanup_pop_restore, GLIBC_2_0);
50 #endif /* OTHER_SHLIB_COMPAT */