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