1169689Skan/* Threads compatibility routines for libgcc2 and libobjc for 2169689Skan LynxOS. */ 3169689Skan/* Compile this one with gcc. */ 4169689Skan/* Copyright (C) 2004 Free Software Foundation, Inc. 5169689Skan 6169689SkanThis file is part of GCC. 7169689Skan 8169689SkanGCC is free software; you can redistribute it and/or modify it under 9169689Skanthe terms of the GNU General Public License as published by the Free 10169689SkanSoftware Foundation; either version 2, or (at your option) any later 11169689Skanversion. 12169689Skan 13169689SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY 14169689SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or 15169689SkanFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16169689Skanfor more details. 17169689Skan 18169689SkanYou should have received a copy of the GNU General Public License 19169689Skanalong with GCC; see the file COPYING. If not, write to the Free 20169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 21169689Skan02110-1301, USA. */ 22169689Skan 23169689Skan/* As a special exception, if you link this library with other files, 24169689Skan some of which are compiled with GCC, to produce an executable, 25169689Skan this library does not by itself cause the resulting executable 26169689Skan to be covered by the GNU General Public License. 27169689Skan This exception does not however invalidate any other reasons why 28169689Skan the executable file might be covered by the GNU General Public License. */ 29169689Skan 30169689Skan#ifndef GCC_GTHR_LYNX_H 31169689Skan#define GCC_GTHR_LYNX_H 32169689Skan 33169689Skan#ifdef _MULTITHREADED 34169689Skan 35169689Skan/* Using the macro version of pthread_setspecific leads to a 36169689Skan compilation error. Instead we have two choices either kill all 37169689Skan macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine 38169689Skan individual macros where we should fall back on the function 39169689Skan implementation. We choose the second approach. */ 40169689Skan 41169689Skan#include <pthread.h> 42169689Skan#undef pthread_setspecific 43169689Skan 44169689Skan/* When using static libc on LynxOS, we cannot define pthread_create 45169689Skan weak. If the multi-threaded application includes iostream.h, 46169689Skan gthr-posix.h is included and pthread_create will be defined weak. 47169689Skan If pthead_create is weak its defining module in libc is not 48169689Skan necessarily included in the link and the symbol is resolved to zero. 49169689Skan Therefore the first call to it will crash. 50169689Skan 51169689Skan Since -mthreads is a multilib switch on LynxOS we know that at this 52169689Skan point we are compiling for multi-threaded. Omitting the weak 53169689Skan definitions at this point should have no effect. */ 54169689Skan 55169689Skan#undef GTHREAD_USE_WEAK 56169689Skan#define GTHREAD_USE_WEAK 0 57169689Skan 58169689Skan#include "gthr-posix.h" 59169689Skan 60169689Skan#else 61169689Skan#include "gthr-single.h" 62169689Skan#endif 63169689Skan 64169689Skan#endif /* GCC_GTHR_LYNX_H */ 65