gthr-lynx.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Threads compatibility routines for libgcc2 and libobjc for
  2. LynxOS. */
  3. /* Compile this one with gcc. */
  4. /* Copyright (C) 2004-2022 Free Software Foundation, Inc.
  5. This file is part of GCC.
  6. GCC is free software; you can redistribute it and/or modify it under
  7. the terms of the GNU General Public License as published by the Free
  8. Software Foundation; either version 3, or (at your option) any later
  9. version.
  10. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. for more details.
  14. Under Section 7 of GPL version 3, you are granted additional
  15. permissions described in the GCC Runtime Library Exception, version
  16. 3.1, as published by the Free Software Foundation.
  17. You should have received a copy of the GNU General Public License and
  18. a copy of the GCC Runtime Library Exception along with this program;
  19. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  20. <http://www.gnu.org/licenses/>. */
  21. #ifndef GCC_GTHR_LYNX_H
  22. #define GCC_GTHR_LYNX_H
  23. #ifdef _MULTITHREADED
  24. /* Using the macro version of pthread_setspecific leads to a
  25. compilation error. Instead we have two choices either kill all
  26. macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine
  27. individual macros where we should fall back on the function
  28. implementation. We choose the second approach. */
  29. #include <pthread.h>
  30. #undef pthread_setspecific
  31. /* When using static libc on LynxOS, we cannot define pthread_create
  32. weak. If the multi-threaded application includes iostream.h,
  33. gthr-posix.h is included and pthread_create will be defined weak.
  34. If pthread_create is weak its defining module in libc is not
  35. necessarily included in the link and the symbol is resolved to zero.
  36. Therefore the first call to it will crash.
  37. Since -mthreads is a multilib switch on LynxOS we know that at this
  38. point we are compiling for multi-threaded. Omitting the weak
  39. definitions at this point should have no effect. */
  40. #undef GTHREAD_USE_WEAK
  41. #define GTHREAD_USE_WEAK 0
  42. #include "gthr-posix.h"
  43. #else
  44. #include "gthr-single.h"
  45. #endif
  46. #endif /* GCC_GTHR_LYNX_H */