1 /* Copyright (C) 2003-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
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 #ifndef _PTHREAD_FUNCTIONS_H
20 #define _PTHREAD_FUNCTIONS_H 1
24 #include <internaltypes.h>
29 /* Data type shared with libc. The libc uses it to pass on calls to
30 the thread functions. */
31 struct pthread_functions
33 int (*ptr___pthread_cond_broadcast
) (pthread_cond_t
*);
34 int (*ptr___pthread_cond_signal
) (pthread_cond_t
*);
35 int (*ptr___pthread_cond_wait
) (pthread_cond_t
*, pthread_mutex_t
*);
36 int (*ptr___pthread_cond_timedwait
) (pthread_cond_t
*, pthread_mutex_t
*,
37 const struct timespec
*);
38 int (*ptr___pthread_cond_broadcast_2_0
) (pthread_cond_2_0_t
*);
39 int (*ptr___pthread_cond_signal_2_0
) (pthread_cond_2_0_t
*);
40 int (*ptr___pthread_cond_wait_2_0
) (pthread_cond_2_0_t
*, pthread_mutex_t
*);
41 int (*ptr___pthread_cond_timedwait_2_0
) (pthread_cond_2_0_t
*,
43 const struct timespec
*);
44 void (*ptr___pthread_exit
) (void *) __attribute__ ((__noreturn__
));
45 int (*ptr_pthread_mutex_destroy
) (pthread_mutex_t
*);
46 int (*ptr_pthread_mutex_init
) (pthread_mutex_t
*,
47 const pthread_mutexattr_t
*);
48 int (*ptr_pthread_mutex_lock
) (pthread_mutex_t
*);
49 int (*ptr_pthread_mutex_unlock
) (pthread_mutex_t
*);
50 int (*ptr___pthread_setcancelstate
) (int, int *);
51 int (*ptr_pthread_setcanceltype
) (int, int *);
52 void (*ptr___pthread_cleanup_upto
) (__jmp_buf
, char *);
53 int (*ptr___pthread_once
) (pthread_once_t
*, void (*) (void));
54 int (*ptr___pthread_rwlock_rdlock
) (pthread_rwlock_t
*);
55 int (*ptr___pthread_rwlock_wrlock
) (pthread_rwlock_t
*);
56 int (*ptr___pthread_rwlock_unlock
) (pthread_rwlock_t
*);
57 int (*ptr___pthread_key_create
) (pthread_key_t
*, void (*) (void *));
58 void *(*ptr___pthread_getspecific
) (pthread_key_t
);
59 int (*ptr___pthread_setspecific
) (pthread_key_t
, const void *);
60 void (*ptr__pthread_cleanup_push_defer
) (struct _pthread_cleanup_buffer
*,
61 void (*) (void *), void *);
62 void (*ptr__pthread_cleanup_pop_restore
) (struct _pthread_cleanup_buffer
*,
64 #define HAVE_PTR_NTHREADS
65 unsigned int *ptr_nthreads
;
66 void (*ptr___pthread_unwind
) (__pthread_unwind_buf_t
*)
67 __attribute ((noreturn
)) __cleanup_fct_attribute
;
68 void (*ptr__nptl_deallocate_tsd
) (void);
69 int (*ptr__nptl_setxid
) (struct xid_command
*);
70 void (*ptr_set_robust
) (struct pthread
*);
73 /* Variable in libc.so. */
74 extern struct pthread_functions __libc_pthread_functions attribute_hidden
;
75 extern int __libc_pthread_functions_init attribute_hidden
;
78 # define PTHFCT_CALL(fct, params) \
79 ({ __typeof (__libc_pthread_functions.fct) __p; \
80 __p = __libc_pthread_functions.fct; \
84 # define PTHFCT_CALL(fct, params) \
85 __libc_pthread_functions.fct params
88 #endif /* pthread-functions.h */