1 |
280 |
jeremybenn |
/* Threads compatibility routines for libgcc2 and libobjc for
|
2 |
|
|
LynxOS. */
|
3 |
|
|
/* Compile this one with gcc. */
|
4 |
|
|
/* Copyright (C) 2004, 2008, 2009 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 3, 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 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
19 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
20 |
|
|
3.1, as published by the Free Software Foundation.
|
21 |
|
|
|
22 |
|
|
You should have received a copy of the GNU General Public License and
|
23 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
24 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
25 |
|
|
<http://www.gnu.org/licenses/>. */
|
26 |
|
|
|
27 |
|
|
#ifndef GCC_GTHR_LYNX_H
|
28 |
|
|
#define GCC_GTHR_LYNX_H
|
29 |
|
|
|
30 |
|
|
#ifdef _MULTITHREADED
|
31 |
|
|
|
32 |
|
|
/* Using the macro version of pthread_setspecific leads to a
|
33 |
|
|
compilation error. Instead we have two choices either kill all
|
34 |
|
|
macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine
|
35 |
|
|
individual macros where we should fall back on the function
|
36 |
|
|
implementation. We choose the second approach. */
|
37 |
|
|
|
38 |
|
|
#include <pthread.h>
|
39 |
|
|
#undef pthread_setspecific
|
40 |
|
|
|
41 |
|
|
/* When using static libc on LynxOS, we cannot define pthread_create
|
42 |
|
|
weak. If the multi-threaded application includes iostream.h,
|
43 |
|
|
gthr-posix.h is included and pthread_create will be defined weak.
|
44 |
|
|
If pthread_create is weak its defining module in libc is not
|
45 |
|
|
necessarily included in the link and the symbol is resolved to zero.
|
46 |
|
|
Therefore the first call to it will crash.
|
47 |
|
|
|
48 |
|
|
Since -mthreads is a multilib switch on LynxOS we know that at this
|
49 |
|
|
point we are compiling for multi-threaded. Omitting the weak
|
50 |
|
|
definitions at this point should have no effect. */
|
51 |
|
|
|
52 |
|
|
#undef GTHREAD_USE_WEAK
|
53 |
|
|
#define GTHREAD_USE_WEAK 0
|
54 |
|
|
|
55 |
|
|
#include "gthr-posix.h"
|
56 |
|
|
|
57 |
|
|
#else
|
58 |
|
|
#include "gthr-single.h"
|
59 |
|
|
#endif
|
60 |
|
|
|
61 |
|
|
#endif /* GCC_GTHR_LYNX_H */
|