Back to index

glibc  2.9
pthread-functions.h
Go to the documentation of this file.
00001 /* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _PTHREAD_FUNCTIONS_H
00021 #define _PTHREAD_FUNCTIONS_H       1
00022 
00023 #include <pthread.h>
00024 #include <setjmp.h>
00025 #include <internaltypes.h>
00026 #include <sysdep.h>
00027 
00028 struct xid_command;
00029 
00030 /* Data type shared with libc.  The libc uses it to pass on calls to
00031    the thread functions.  */
00032 struct pthread_functions
00033 {
00034   int (*ptr_pthread_attr_destroy) (pthread_attr_t *);
00035   int (*ptr___pthread_attr_init_2_0) (pthread_attr_t *);
00036   int (*ptr___pthread_attr_init_2_1) (pthread_attr_t *);
00037   int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *);
00038   int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int);
00039   int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *);
00040   int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int);
00041   int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *,
00042                                     struct sched_param *);
00043   int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *,
00044                                     const struct sched_param *);
00045   int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *);
00046   int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int);
00047   int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *);
00048   int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int);
00049   int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *);
00050   int (*ptr_pthread_condattr_init) (pthread_condattr_t *);
00051   int (*ptr___pthread_cond_broadcast) (pthread_cond_t *);
00052   int (*ptr___pthread_cond_destroy) (pthread_cond_t *);
00053   int (*ptr___pthread_cond_init) (pthread_cond_t *,
00054                               const pthread_condattr_t *);
00055   int (*ptr___pthread_cond_signal) (pthread_cond_t *);
00056   int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
00057   int (*ptr___pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
00058                                    const struct timespec *);
00059   int (*ptr___pthread_cond_broadcast_2_0) (pthread_cond_2_0_t *);
00060   int (*ptr___pthread_cond_destroy_2_0) (pthread_cond_2_0_t *);
00061   int (*ptr___pthread_cond_init_2_0) (pthread_cond_2_0_t *,
00062                                   const pthread_condattr_t *);
00063   int (*ptr___pthread_cond_signal_2_0) (pthread_cond_2_0_t *);
00064   int (*ptr___pthread_cond_wait_2_0) (pthread_cond_2_0_t *, pthread_mutex_t *);
00065   int (*ptr___pthread_cond_timedwait_2_0) (pthread_cond_2_0_t *,
00066                                       pthread_mutex_t *,
00067                                       const struct timespec *);
00068   int (*ptr_pthread_equal) (pthread_t, pthread_t);
00069   void (*ptr___pthread_exit) (void *);
00070   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
00071   int (*ptr_pthread_setschedparam) (pthread_t, int,
00072                                 const struct sched_param *);
00073   int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *);
00074   int (*ptr_pthread_mutex_init) (pthread_mutex_t *,
00075                              const pthread_mutexattr_t *);
00076   int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
00077   int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
00078   pthread_t (*ptr_pthread_self) (void);
00079   int (*ptr_pthread_setcancelstate) (int, int *);
00080   int (*ptr_pthread_setcanceltype) (int, int *);
00081   void (*ptr___pthread_cleanup_upto) (__jmp_buf, char *);
00082   int (*ptr___pthread_once) (pthread_once_t *, void (*) (void));
00083   int (*ptr___pthread_rwlock_rdlock) (pthread_rwlock_t *);
00084   int (*ptr___pthread_rwlock_wrlock) (pthread_rwlock_t *);
00085   int (*ptr___pthread_rwlock_unlock) (pthread_rwlock_t *);
00086   int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *));
00087   void *(*ptr___pthread_getspecific) (pthread_key_t);
00088   int (*ptr___pthread_setspecific) (pthread_key_t, const void *);
00089   void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer *,
00090                                       void (*) (void *), void *);
00091   void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer *,
00092                                        int);
00093 #define HAVE_PTR_NTHREADS
00094   unsigned int *ptr_nthreads;
00095   void (*ptr___pthread_unwind) (__pthread_unwind_buf_t *)
00096        __attribute ((noreturn)) __cleanup_fct_attribute;
00097   void (*ptr__nptl_deallocate_tsd) (void);
00098   int (*ptr__nptl_setxid) (struct xid_command *);
00099   void (*ptr_freeres) (void);
00100 };
00101 
00102 /* Variable in libc.so.  */
00103 extern struct pthread_functions __libc_pthread_functions attribute_hidden;
00104 extern int __libc_pthread_functions_init attribute_hidden;
00105 
00106 #ifdef PTR_DEMANGLE
00107 # define PTHFCT_CALL(fct, params) \
00108   ({ __typeof (__libc_pthread_functions.fct) __p;                           \
00109      __p = __libc_pthread_functions.fct;                             \
00110      PTR_DEMANGLE (__p);                                             \
00111      __p params; })
00112 #else
00113 # define PTHFCT_CALL(fct, params) \
00114   __libc_pthread_functions.fct params
00115 #endif
00116 
00117 #endif /* pthread-functions.h */