OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / gthr-lynx.h
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.
5
6 This file is part of GCC.
7
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.
12
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.
17
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, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.  */
22
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.  */
29
30 #ifndef GCC_GTHR_LYNX_H
31 #define GCC_GTHR_LYNX_H
32
33 #ifdef _MULTITHREADED
34
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.  */
40
41 #include <pthread.h>
42 #undef pthread_setspecific
43
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.
50
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.  */
54
55 #undef  GTHREAD_USE_WEAK
56 #define GTHREAD_USE_WEAK 0
57
58 #include "gthr-posix.h"
59
60 #else
61 #include "gthr-single.h"
62 #endif
63
64 #endif /* GCC_GTHR_LYNX_H */