(root)/
glibc-2.38/
htl/
pt-initialize.c
       1  /* Initialize pthreads library.
       2     Copyright (C) 2000-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       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 <assert.h>
      20  #include <string.h>
      21  
      22  #include <pt-internal.h>
      23  #include <set-hooks.h>
      24  
      25  #include <pthread.h>
      26  #include <pthread-functions.h>
      27  
      28  #if IS_IN (libpthread)
      29  static const struct pthread_functions pthread_functions = {
      30    .ptr_pthread_attr_destroy = __pthread_attr_destroy,
      31    .ptr_pthread_attr_init = __pthread_attr_init,
      32    .ptr_pthread_attr_getdetachstate = __pthread_attr_getdetachstate,
      33    .ptr_pthread_attr_setdetachstate = __pthread_attr_setdetachstate,
      34    .ptr_pthread_attr_getinheritsched = __pthread_attr_getinheritsched,
      35    .ptr_pthread_attr_setinheritsched = __pthread_attr_setinheritsched,
      36    .ptr_pthread_attr_getschedparam = __pthread_attr_getschedparam,
      37    .ptr_pthread_attr_setschedparam = __pthread_attr_setschedparam,
      38    .ptr_pthread_attr_getschedpolicy = __pthread_attr_getschedpolicy,
      39    .ptr_pthread_attr_setschedpolicy = __pthread_attr_setschedpolicy,
      40    .ptr_pthread_attr_getscope = __pthread_attr_getscope,
      41    .ptr_pthread_attr_setscope = __pthread_attr_setscope,
      42    .ptr_pthread_condattr_destroy = __pthread_condattr_destroy,
      43    .ptr_pthread_condattr_init = __pthread_condattr_init,
      44    .ptr_pthread_cond_broadcast = __pthread_cond_broadcast,
      45    .ptr_pthread_cond_destroy = __pthread_cond_destroy,
      46    .ptr_pthread_cond_init = __pthread_cond_init,
      47    .ptr_pthread_cond_signal = __pthread_cond_signal,
      48    .ptr_pthread_cond_wait = __pthread_cond_wait,
      49    .ptr_pthread_cond_timedwait = __pthread_cond_timedwait,
      50    .ptr_pthread_equal = __pthread_equal,
      51    .ptr___pthread_exit = __pthread_exit,
      52    .ptr_pthread_getschedparam = __pthread_getschedparam,
      53    .ptr_pthread_setschedparam = __pthread_setschedparam,
      54    .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
      55    .ptr_pthread_mutex_init = __pthread_mutex_init,
      56    .ptr_pthread_mutex_lock = __pthread_mutex_lock,
      57    .ptr_pthread_mutex_trylock = __pthread_mutex_trylock,
      58    .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
      59    .ptr___pthread_setcancelstate = __pthread_setcancelstate,
      60    .ptr_pthread_setcanceltype = __pthread_setcanceltype,
      61    .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
      62    .ptr_pthread_once = __pthread_once,
      63    .ptr_pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
      64    .ptr_pthread_rwlock_wrlock = __pthread_rwlock_wrlock,
      65    .ptr_pthread_rwlock_unlock = __pthread_rwlock_unlock,
      66    .ptr___pthread_key_create = __pthread_key_create,
      67    .ptr___pthread_getspecific = __pthread_getspecific,
      68    .ptr___pthread_setspecific = __pthread_setspecific,
      69    .ptr__IO_flockfile = _cthreads_flockfile,
      70    .ptr__IO_funlockfile = _cthreads_funlockfile,
      71    .ptr__IO_ftrylockfile = _cthreads_ftrylockfile,
      72  };
      73  #endif /* IS_IN (libpthread) */
      74  
      75  /* Initialize the pthreads library.  */
      76  void
      77  ___pthread_init (void)
      78  {
      79  #if IS_IN (libpthread)
      80    __libc_pthread_init (&pthread_functions);
      81  #endif
      82  }