sysdep-cancel.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * This file is subject to the terms and conditions of the LGPV V2.1
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2019 Kalray Inc.
  7. */
  8. #include <sysdep.h>
  9. #include <tls.h>
  10. #ifndef __ASSEMBLER__
  11. # include <pthreadP.h>
  12. #endif
  13. #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
  14. # if defined IS_IN_libpthread
  15. # define __local_multiple_threads __pthread_multiple_threads
  16. # elif !defined NOT_IN_libc
  17. # define __local_multiple_threads __libc_multiple_threads
  18. # endif
  19. # if defined IS_IN_libpthread || !defined NOT_IN_libc
  20. extern int __local_multiple_threads attribute_hidden;
  21. # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
  22. # else
  23. /* There is no __local_multiple_threads for librt, so use the TCB. */
  24. # define SINGLE_THREAD_P \
  25. __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
  26. header.multiple_threads) == 0, 1)
  27. # endif
  28. #else
  29. /* For rtld, et cetera. */
  30. # define SINGLE_THREAD_P 1
  31. # define NO_CANCELLATION 1
  32. #endif
  33. # define RTLD_SINGLE_THREAD_P \
  34. __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
  35. header.multiple_threads) == 0, 1)