sysdep-cancel.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (C) 2017 Hangzhou C-SKY Microsystems co.,ltd.
  3. *
  4. * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
  5. * in this tarball.
  6. */
  7. #include <sysdep.h>
  8. #include <tls.h>
  9. #ifndef __ASSEMBLER__
  10. #include <pthreadP.h>
  11. #endif
  12. #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
  13. # ifdef IS_IN_libpthread
  14. # define __local_multiple_threads __pthread_multiple_threads
  15. # elif !defined NOT_IN_libc
  16. # define __local_multiple_threads __libc_multiple_threads
  17. # endif
  18. # if defined IS_IN_libpthread || !defined NOT_IN_libc
  19. extern int __local_multiple_threads attribute_hidden;
  20. # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
  21. # else
  22. # define SINGLE_THREAD_P \
  23. __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
  24. header.multiple_threads) == 0, 1)
  25. # endif
  26. #else
  27. # define SINGLE_THREAD_P 1
  28. # define NO_CANCELLATION 1
  29. #endif
  30. #define RTLD_SINGLE_THREAD_P \
  31. __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
  32. header.multiple_threads) == 0, 1)