| xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | /* Copyright (C) 2003-2016 Free Software Foundation, Inc. | 
|  | 2 | This file is part of the GNU C Library. | 
|  | 3 | Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. | 
|  | 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 | <http://www.gnu.org/licenses/>.  */ | 
|  | 18 |  | 
|  | 19 | #include <pthread.h> | 
|  | 20 | #include <stdio.h> | 
|  | 21 | #include <stdlib.h> | 
|  | 22 | #include <unistd.h> | 
|  | 23 |  | 
|  | 24 | extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, | 
|  | 25 | void (*__routine) (void *), | 
|  | 26 | void *__arg); | 
|  | 27 | extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, | 
|  | 28 | int __execute); | 
|  | 29 |  | 
|  | 30 | extern void clh (void *arg); | 
|  | 31 | extern void fn0 (void); | 
|  | 32 | extern void fn1 (void); | 
|  | 33 | extern void fn5 (void); | 
|  | 34 | extern void fn7 (void); | 
|  | 35 | extern void fn9 (void); | 
|  | 36 |  | 
|  | 37 |  | 
|  | 38 | static __attribute__((noinline)) void | 
|  | 39 | fn3 (void) | 
|  | 40 | { | 
|  | 41 | /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */ | 
|  | 42 | struct _pthread_cleanup_buffer b; | 
|  | 43 | _pthread_cleanup_push (&b, clh, (void *) 4l); | 
|  | 44 |  | 
|  | 45 | fn0 (); | 
|  | 46 |  | 
|  | 47 | _pthread_cleanup_pop (&b, 1); | 
|  | 48 | } | 
|  | 49 |  | 
|  | 50 |  | 
|  | 51 | static __attribute__((noinline)) void | 
|  | 52 | fn4 (void) | 
|  | 53 | { | 
|  | 54 | pthread_cleanup_push (clh, (void *) 5l); | 
|  | 55 |  | 
|  | 56 | fn3 (); | 
|  | 57 |  | 
|  | 58 | pthread_cleanup_pop (1); | 
|  | 59 | } | 
|  | 60 |  | 
|  | 61 |  | 
|  | 62 | void | 
|  | 63 | fn5 (void) | 
|  | 64 | { | 
|  | 65 | /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */ | 
|  | 66 | struct _pthread_cleanup_buffer b; | 
|  | 67 | _pthread_cleanup_push (&b, clh, (void *) 6l); | 
|  | 68 |  | 
|  | 69 | fn4 (); | 
|  | 70 |  | 
|  | 71 | _pthread_cleanup_pop (&b, 1); | 
|  | 72 | } | 
|  | 73 |  | 
|  | 74 |  | 
|  | 75 | static __attribute__((noinline)) void | 
|  | 76 | fn6 (void) | 
|  | 77 | { | 
|  | 78 | pthread_cleanup_push (clh, (void *) 7l); | 
|  | 79 |  | 
|  | 80 | fn0 (); | 
|  | 81 |  | 
|  | 82 | pthread_cleanup_pop (1); | 
|  | 83 | } | 
|  | 84 |  | 
|  | 85 |  | 
|  | 86 | void | 
|  | 87 | fn7 (void) | 
|  | 88 | { | 
|  | 89 | /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */ | 
|  | 90 | struct _pthread_cleanup_buffer b; | 
|  | 91 | _pthread_cleanup_push (&b, clh, (void *) 8l); | 
|  | 92 |  | 
|  | 93 | fn6 (); | 
|  | 94 |  | 
|  | 95 | _pthread_cleanup_pop (&b, 1); | 
|  | 96 | } | 
|  | 97 |  | 
|  | 98 |  | 
|  | 99 | static __attribute__((noinline)) void | 
|  | 100 | fn8 (void) | 
|  | 101 | { | 
|  | 102 | pthread_cleanup_push (clh, (void *) 9l); | 
|  | 103 |  | 
|  | 104 | fn1 (); | 
|  | 105 |  | 
|  | 106 | pthread_cleanup_pop (1); | 
|  | 107 | } | 
|  | 108 |  | 
|  | 109 |  | 
|  | 110 | void | 
|  | 111 | fn9 (void) | 
|  | 112 | { | 
|  | 113 | /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */ | 
|  | 114 | struct _pthread_cleanup_buffer b; | 
|  | 115 | _pthread_cleanup_push (&b, clh, (void *) 10l); | 
|  | 116 |  | 
|  | 117 | fn8 (); | 
|  | 118 |  | 
|  | 119 | _pthread_cleanup_pop (&b, 1); | 
|  | 120 | } |