2006-01-05 Paolo Carlini <pcarlini@suse.de>
[official-gcc.git] / gcc / gthr-lynx.h
blob8d2d72b9d97d81b9c9adfb193ebf69820965bbff
1 /* Threads compatibility routines for libgcc2 and libobjc for
2 LynxOS. */
3 /* Compile this one with gcc. */
4 /* Copyright (C) 2004 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA. */
23 /* As a special exception, if you link this library with other files,
24 some of which are compiled with GCC, to produce an executable,
25 this library does not by itself cause the resulting executable
26 to be covered by the GNU General Public License.
27 This exception does not however invalidate any other reasons why
28 the executable file might be covered by the GNU General Public License. */
30 #ifndef GCC_GTHR_LYNX_H
31 #define GCC_GTHR_LYNX_H
33 #ifdef _MULTITHREADED
35 /* Using the macro version of pthread_setspecific leads to a
36 compilation error. Instead we have two choices either kill all
37 macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine
38 individual macros where we should fall back on the function
39 implementation. We choose the second approach. */
41 #include <pthread.h>
42 #undef pthread_setspecific
44 /* When using static libc on LynxOS, we cannot define pthread_create
45 weak. If the multi-threaded application includes iostream.h,
46 gthr-posix.h is included and pthread_create will be defined weak.
47 If pthead_create is weak its defining module in libc is not
48 necessarily included in the link and the symbol is resolved to zero.
49 Therefore the first call to it will crash.
51 Since -mthreads is a multilib switch on LynxOS we know that at this
52 point we are compiling for multi-threaded. Omitting the weak
53 definitions at this point should have no effect. */
55 #undef GTHREAD_USE_WEAK
56 #define GTHREAD_USE_WEAK 0
58 #include "gthr-posix.h"
60 #else
61 #include "gthr-single.h"
62 #endif
64 #endif /* GCC_GTHR_LYNX_H */